• 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: unsigned 16 digit integer data type?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unsigned 16 digit integer data type?


  • Subject: Re: unsigned 16 digit integer data type?
  • From: Wade Tregaskis <email@hidden>
  • Date: Wed, 5 Nov 2003 14:53:54 +1100

Also think about using the uint64_t typedef rather than
explicitly spelling out unsigned long long.

The maximum value of a 64-bit unsigned would be 2 ^ 32 * 2 ^ 32 - 1,
or 18,446,744,073,709,551,615 --- that is more than eighteen
million trillion. Certainly big enough for sixteen decimal
digits.

off list someone suggested double. and that seems to work fine. is double better option for 16 decimal digit values maybe? 16 digits is the absolute maximum i need to store - there's no chance of it going over that. space is an issue as i have a lot of them to store so i'd like the tightest possible fit.

Double's may not have enough significant digits in the mantissa to hold your value accurately - and even if they do on the PPC, they may not on other platforms. If you can fit into a UInt64, you're best using that - worst case scenario when porting to another platform is you'll have to find (or write) some code for handling UInt64's piecewise (e.g. in 16-bit chunks on many microcontrollers). Such a thing is relatively easy.

It sounds like you're storing some kind of ID number, which is why I'd recommend against any floating point notations. It's very easy to extend integer operations up to an arbitrary size, on any platform.

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: unsigned 16 digit integer data type? (From: Ben Dougall <email@hidden>)

  • Prev by Date: Re: obj-c newb question
  • Next by Date: Re: Running an App as Root
  • Previous by thread: Re: unsigned 16 digit integer data type?
  • Next by thread: Re: unsigned 16 digit integer data type?
  • Index(es):
    • Date
    • Thread