Re: How to pretty print floating numbers (without loosing precision)?
Re: How to pretty print floating numbers (without loosing precision)?
- Subject: Re: How to pretty print floating numbers (without loosing precision)?
- From: Scott Ribe <email@hidden>
- Date: Sat, 11 Oct 2014 07:47:13 -0600
On Oct 11, 2014, at 7:36 AM, Scott Ribe <email@hidden> wrote:
> On Oct 11, 2014, at 2:04 AM, Gerriet M. Denkmann <email@hidden> wrote:
>
>> Note: converting to double does NOT loose any digits.
>
> Well, it has to. Not sure how you're getting that output, but a double has 52 bits for the mantissa, so the largest integer it can represent without losing precision is about 4.5x10^15.
Oops. Forgot the implicit MSB 1 in normalized doubles, so I guess max is ~9X10^15.
Anyway, your number is well into the range where it lose binary digits, so it would just be pure (very unlikely) luck if that specific integer happened to be one that is precisely representable as a double.
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden