I have also seen this problem with multiplication and division. I have been
adding float support to iScript (WMLScript library) and noticed this. Adding
and subtracting floating numbers is fine. And math with integers are
perfect.

All I do is a * b or a / b. I can post some tests later. The result is
usually not too far off from being correct (although it does not appear to
look like rounding).

-Donald

"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