On Fri, Oct 10, 2008 at 7:04 AM, Steven Hamilton <[EMAIL PROTECTED]> wrote:
> The float calculation is exactly 2
> decimal places

This is unlikely. There are very few numbers with two decimal places
which can be perfectly represented in floating-point numbers. (Those
would be numbers with fractional values that can be composed from
powers of two, i.e. 0.25, 0.5, and 0.75.)

You'll probably want to read this:

http://docs.sun.com/source/806-3568/ncg_goldberg.html

And then stop using floating point math for anything which you require
to produce an exact result.

For money, the best thing to do is to simply perform calculations in
cents using integers, then divide by 100 for display purposes only.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to