• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to pretty print floating numbers (without loosing precision)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to pretty print floating numbers (without loosing precision)?
      • From: "Gerriet M. Denkmann" <email@hidden>
References: 
 >How to pretty print floating numbers (without loosing precision)? (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Concurrent tasks are getting hung up
  • Next by Date: Re: Concurrent tasks are getting hung up
  • Previous by thread: How to pretty print floating numbers (without loosing precision)?
  • Next by thread: Re: How to pretty print floating numbers (without loosing precision)?
  • Index(es):
    • Date
    • Thread