Skip to main content
gamedev.net
🔒 Locked

normalizing numbers

Started by Nodger 5 replies 350+ views
Original Post
Nodger
Nodger
Sorry for posting this dumb question, I SHOULD figure it out myself but its 3:40 AM... anyway, I want to normalize a bunch of numbers (floats) to the range 0-100, (yes I tried google) , so for example if I have a lower limit of 10 and an upper limit of 30 then 20 would become 50, because its halfway between 10 and 30...
yaroslavd
yaroslavd
num = (num-lowerbound)*100/(higherbound-lowerbound)


I think...
angry
angry
too fast

[edited by - angry on March 31, 2004 10:59:02 PM]
Nodger
Nodger
uh.. i want to find the 50

fuck it.. maybe Ill go to sleep for a few hours
hplus0603
hplus0603
midpoint(set) = (min(set) + max(set)) / 2
enum Bool { True, False, FileNotFound };
Specchum
Specchum
hplus, he doesn''t want the average of two numbers but normalized numbers.

yaroslavd''s equation is spot on methinks. I don''t understand wot Nodger meant by his reply though. You WILL get 50 if you use the equation, except that LHS should perhaps read ''normalized'' instead of ''num'' to avoid confusion.

"There is no dark side of the moon." - Pink Floyd
"There is no dark side of the moon." - Pink Floyd

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.