Just keeps getting stranger... now 0.1551 * 10000.0 is giving me 1550.  I 
have proof that it wasn't doing this yesterday!

Anyway, after some discussion with another programmer I work with, we 
decided to change our app to do strictly integer math.  That should 
eliminate our floating woes.

"Jim McGowen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Found something strange... Looks like Palm OS 5 changes certain numbers 
> multiplying.  For example:
>  double x = 0.141;
>  long y = (long)( x * 10000.0 );
>
> y becomes 1409.
>
> Also:
>  double x = 1410.0;
>  double test = 0.141;
>  double y = test * 10000.0;
>  double z = 0.141 * 10000.0;
>
> x = = 1410.0 = = 
> 0100000010010110000010000000000000000000000000000000000000000000
> y = = 1410.0 = = 
> 0100000010010110000001111111111111111111111111111111111111111111
> z = =1410.0 = = 
> 0100000010010110000010000000000000000000000000000000000000000000
>
> Casting z to a long gives 1409.
> Only happens with certain "problem" numbers like this one.  Haven't tried 
> it in any other OS version.  Is there a way to fix or get around this?
>
> - Jim
>
> 



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to