SPUG:strange rounding problems

Brian Hatch spug at ifokr.org
Thu Jan 30 16:42:27 CST 2003



> Odd rounds up, even rounds down.

How rounding works is very dependent on what you want.

Sales tax, for instance, round up.

Fractional Cents => Rounded cents
           10.98 => 11
           10.99 => 11
           11.00 => 11
           11.01 => 12
           11.02 => 12
                ...
           11.99 => 12
           12.00 => 12

So the moral of the story is "be sure things do what you
want them to do, don't expect them to do what you think
is right, and don't say that what it does is wrong."



--
Brian Hatch                  Attitudes are contagious.
   Systems and                Mine might kill you.
   Security Engineer
http://www.ifokr.org/bri/

Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/spug-list/attachments/20030130/902cdaa0/attachment.bin


More information about the spug-list mailing list