CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

"problem" in mathematical formula

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jccsantos



Joined: 01 Nov 2005
Posts: 6

View user's profile Send private message

"problem" in mathematical formula
PostPosted: Sat Dec 10, 2005 3:03 pm     Reply with quote

Hi,

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

View user's profile Send private message

PostPosted: Sat Dec 10, 2005 4:16 pm     Reply with quote

Code:
VAR = 254 - ((MAX-X)/(MAX-MIN) * 254)

Just off the top of my head...

-special [k]
jccsantos



Joined: 01 Nov 2005
Posts: 6

View user's profile Send private message

PostPosted: Sun Dec 11, 2005 7:49 am     Reply with quote

@specialk

Thankīs, itīs the only thing that i canīt solve until now Cool
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group