Game Development Community

e1.001e-10 (solved)

by rennie moffat · in Torque Game Builder · 02/03/2011 (12:24 pm) · 4 replies

Hi there,
I have a scoring system set up, where I calculate my score like this....

$Score = $Score + %this.worth;

%this.worth is a dynamic field, set via a behaviorfield. The problem I am getting is that I am getting some funny results. One of which is this....
e1.001e-10
when it should be 1.000

What does this mean?



Cheers in advance.
Ren

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
02/03/2011 (2:19 pm)
it means 0.0000000001001. You might need to check your values. Integer math is nice.
#2
02/03/2011 (2:22 pm)
great thanks.












#3
02/04/2011 (7:17 am)
echo %this.worth before you add it. You'll probably find it's getting corrupted somehow.
#4
02/04/2011 (9:41 am)
It was the fact I would always dived it by 1000. Fine the first time, but t would get infinitesimally small each time. Instead, I changed the values of worth from whole numbers, 75, 50, 25 to 0.075, 0.050, 0.025 and removed the divide by 1000 all together. Works fine.