# Need Math Help

Hi everyone,

I’ve got a math node in my head right now.

I need to convert a value from 0 to 255 to a percentage. The number 1000 later corresponds to 1 percent and the number 100.000 later to 100 percent. So the multiplication foldor is 1000, can someone please help me reactivate my synapses? No jokes please. Its late at night in Europe.

Thanks.

Wouldn’t it just be `( v / 255.0 ) * 1000.0` ?

If you want 1% = 1000 and 100% = 100,000 you will need

``( v / 255.0) * 100000.0 ``

no?

If v = 2.55 then it is 1%, 2.55 / 255 = 0.01 * 100000 = 1000 = 1%
If v = 255 then it is 100%, 255 / 255 = 1 * 100000 = 100000 = 100%

Sadly not Kem. Ive to translate a Opacity value 0…255 (1% = 2,55) to the right value in range 0…100.000

given a value between 0 and 255, calcuate the proportinate value that exists between 0 and 100 where 0 corresponds to 0 and 255 corresponds to 100?

(v/255)*100

v/255 is a percentage that v represents of 0 to 255, multiplied by the target value 100

v=0 : result =0
v=255 : result =100

``result=minz+((v-minR)/(maxR-minR))*(maxZ-minZ)``

that is the actual equation, but MinR and MinZ can be left out as in this situation , both are ZERO

MinR=0, MaxR=255
MinZ=0, MaxZ=100

I think Martin is using (.) to separate thousands and not (,) as we use in USA and Mexico. That’s why I used 100000.

Yes, you are right

I got it:

``result = ((v * 1000) / 2550) * 1000``

``result = v / 255 * 100000 'Convert 0-255 values to 0-100000 ``