tags:

views:

89

answers:

9

i'm terrible at math. trust me, you math experts will see why after reading my question.

i have an object that is 300px in height. i need to calculate the percentage of that height where 90% = 300px (or the full height), 45% = 150px, 0% = 0px. so essentially, if i ask for 45% of the object's height, it will return 150px, or if i ask for 32% of the object's height, it will return __?

i believe this is really basic math, so i apologize in advance.

A: 

Are you asking how to calculate percentages?

300 * .90 = 270

270 is 90% of 300.

Is that what you're after?

Or are you after the original percentage?

If you know 150 is 45% of X, then

X = 150 / .45

Result: 333

Dan Heberden
+3  A: 

If 90% of it is 300, 100% of it is:

100/90 * 300 = 333.33

Change the 100 to whatever else to get other percentages.

45/90 * 300 = 150
32/90 * 300 = 106.67
rjmunro
32/90 * 300 = 106.67, not 440
Jazza
@Jazza Thanks. I had mistyped 132/90 * 300 and copied the answer here. Fixed now. :-)
rjmunro
+3  A: 

300 / 90 = 3.3333 px (= 1%)

32 * 3.3333 = 106.56

Greco
that was it. thanks. :)
TheDarkInI1978
+1  A: 

(45 / 90) * 300 = 150px

(32 / 90) * 300 = ~106px

Undeph
A: 

You can't have two different proportions of something have the same value.

If 100% is 300px and 90% is the same, then you're using some ranges where the size is the same. The question is what's the range size, so you can see in what range you 32% is.

Rox
A: 
pixels = percentage * constant

In your case is constant = 300/90 = 10/3 = 3.333

Curd
A: 
45%   150
100%   x

x = (150 * 100) / 45 = 333.33

100% is 333.33 so 32% is 333.33 * 0.32 = 106.67

kgiannakakis
A: 

Your Answer = 106.66

A: 

If you compute how much 90% of an objects height is, you do it like:

height * 0.9 = something

something in your case, was 300, thus we have

height * 0.9 = 300

by dividing both sides with 0.9 we now get:

height = 300 / 0.9 = 333.33...

thus the answer is that the "original"/100% height of the object is 333.33... pixels.

aioobe