Re: unsigned 16 digit integer data type?
Re: unsigned 16 digit integer data type?
- Subject: Re: unsigned 16 digit integer data type?
- From: Clark Cox <email@hidden>
- Date: Tue, 4 Nov 2003 23:42:39 -0500
On Nov 04, 2003, at 21:52, Ben Dougall wrote:
>
On Tuesday, November 4, 2003, at 11:49 pm, Henry McGilton wrote:
>
>
> On Tuesday, November 4, 2003, at 02:27 PM, Clark Cox wrote:
>
>
>
>> On Nov 04, 2003, at 16:21, Matt Gillette wrote:
>
>>
>
>>>> how can you print a long long out?
>
>>>
>
>>> To print out unsigned long long, use %q (quad - I think)
>
>>>
>
>>>> what's the maximum value of a unsigned long long?
>
>>>
>
>>> Not sure, but wouldn't it be 2^64 - 1?
>
>>
>
>> Yes, but remember that that is the maximum guaranteed value (a
>
>> compiler/platform is free to support larger sizes)
>
>>
>
>
>
> 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.
On most platforms (OSX included), double and long long both take the
same amount of memory to store (8 bytes), so whether or not space is an
issue is irrelevant. Both of the types will handle 16 decimal digits,
however, if you use double, you'll have to worry about fractional
values.
--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.