I am to make a program, but I am with a problem in the programming that is the following one:
We have two variable MIN and MAX, and we have another one (VAR) from 0 to 254.
What I intend to make:
The variable VAR must have the value of 0 for MIN and the value of 254 for MAX.
In the practical one it was this:
Code:
MIN=17
MAX=20
X=17.00 -> VAR=0
X=20.00 -> VAR=254
OR
Code:
MIN=17
MAX=18
X=17.00 -> VAR=0
X=18.00 -> VAR=254
But I do not know a formula how to get these values(VAR).
Thanks in advance.
specialk
Joined: 12 Nov 2005 Posts: 27
Posted: Sat Dec 10, 2005 4:16 pm
Code:
VAR = 254 - ((MAX-X)/(MAX-MIN) * 254)
Just off the top of my head...
-special [k]
jccsantos
Joined: 01 Nov 2005 Posts: 6
Posted: Sun Dec 11, 2005 7:49 am
@specialk
Thank�s, it�s the only thing that i can�t solve until now
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum