On 15 Aug 2009, at 08:01, Adil Saleem wrote:

But why would it round 863.6 ? I mean there is only 1 digit after the decimal. It should not have the range problem with a value this small.

Decimal numbers are not necessarily exactly representable in binary. The C library makes it look like some of them are in many cases by careful rounding in its output routines, but of course it cannot always hide the fact that some numbers are necessarily inexact.

A very good document was published in ACM Computing Surveys back in 1991, entitled "What Every Computer Scientist Should Know About Floating-Point Arithmetic". Sun Microsystems reprinted it in 1994, and you can get a PDF of that version here:

  <http://dlc.sun.com/pdf/800-7895/800-7895.pdf>

It's very aptly titled and well worth reading.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

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 arch...@mail-archive.com

Reply via email to