473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

A bit of math logic please

Hi, basically I need a function which will return a number for...

Given a number n (Say 800px) by what factor do I need to shrink it to
get it as close to but not over 300px?

Bear in mind that the number n may be 301px or 1638px

Thanks for any help!
Kate

Jul 6 '07 #1
2 1124
ca*******@myoddjobs.info wrote:
Hi, basically I need a function which will return a number for...

Given a number n (Say 800px) by what factor do I need to shrink it to
get it as close to but not over 300px?

Bear in mind that the number n may be 301px or 1638px
That's not a number. Lets work with numbers.

The factor is simply 300/n.

300/800 = 0.375

800 * 0.375 = 300

--
Göran Andersson
_____
http://www.guffa.com
Jul 6 '07 #2
On Jul 6, 7:54 pm, Göran Andersson <g...@guffa.comwrote:
cather...@myoddjobs.info wrote:
Hi, basically I need a function which will return a number for...
Given a number n (Say 800px) by what factor do I need to shrink it to
get it as close to but not over 300px?
Bear in mind that the number n may be 301px or 1638px

That's not a number. Lets work with numbers.

The factor is simply 300/n.

300/800 = 0.375

800 * 0.375 = 300

--
Göran Andersson
_____http://www.guffa.com
Thank you!

Jul 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bibby | last post by:
I'm interesting in studying OOP programming languages on my own: C, C++, Java. I haven't studied the big 4 math subjects in my last year of high school, Calculus, Algebra, Geometry, Statistics....
4
by: Robert Scheer | last post by:
Hi. Reading about the Math.random method I saw that by default it generates between 0 and 1. To generate numbers between a greater range I can use these syntaxes: x = Math.random()/10 x =...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
6
by: RobG | last post by:
I am writing a script to move an absolutely positioned element on a page by a factor using style.top & style.left. The amount to move by is always some fraction, so I was tossing up between...
3
by: David | last post by:
Here is some code. I am trying to figure out how to raise, say, x to the yth power. I know that isn't explicitly what is in the code but that is the idea I am trying to solve. See the 2nd for...
21
by: Rich | last post by:
I was considering C# for developing a scientific application, but I have noticed a ~30% difference between VC++ .NET and C# on the same machine, under identical conditions: double a = 0,b = 0, c...
5
by: | last post by:
Greetings All, I have a question on a math loop and programming it in VB.net Here's the logic: While Num < 0.0998 And > .0801 Num / 2 Loop Num / 11
6
by: Michael Trausch | last post by:
Hello everyone, I'm having a little bit of trouble trying to implement some arithmetic logic into an application that I'm working on, and I'm hoping that somebody can possibly point me in the...
110
by: Gregory Pietsch | last post by:
I'm writing a portable implementation of the C standard library for http://www.clc-wiki.net and I was wondering if someone could check the functions in math.h for sanity/portability/whatever. I'm...
2
by: zfareed | last post by:
Can anyone suggest some resources (websites/books) to learn coding discrete math problems? I have a problem involving sets,relations and functions and even though the logic is clear I dont know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.