number conversion

Newbie with Lua - I’m normalizing a range of 16 bit integers of the range

-32768 to 32767

I want to normalize to the new range -1 to 1

I’m using the formula:
a+((x-A)*(b-a))/(B-A)

The problem is I’m getting the odd number like
-1 normalizes to -1.525092186696e-005

can some tell me how I can ensure all the normalized results regular numbers like -0.9765645353435 or 0.4544645674754 , etc… and get rid of the scientific notation ?

[import]uid: 97524 topic_id: 18982 reply_id: 318982[/import]

Hey, Dax, is this what you are looking for?

http://developer.anscamobile.com/content/math-0

http://developer.anscamobile.com/content/math

Naomi [import]uid: 67217 topic_id: 18982 reply_id: 73101[/import]