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 15:13:26 -0500
On Nov 04, 2003, at 15:04, Ben Dougall wrote:
>
>
On Tuesday, November 4, 2003, at 07:19 pm, Clark Cox wrote:
>
>
>
>
> On Nov 04, 2003, at 13:40, Ben Dougall wrote:
>
>
>
>> is there a data type that'll store an unsigned 16 digit integer?
>
>
>
> Do you mean 16-*bit*? or do you really mean 16 *digit*?
>
>
>
> If it's the former, then unsigned short should do just fine. On the
>
> other hand, if it's the latter, then you can use unsigned long long.
>
>
the latter. thanks. i had tried long long but assumed it wasn't
>
working because when i tried it the print out from NSLog was 0, even
>
though it'd been set to a value. i've just tried it again and got a
>
different incorrect result:
>
>
unsigned long long n;
>
n = 1234567890987654;
>
NSLog(@"%u", n);
>
>
which gives 287445 for some reason.
%u expects an unsigned int, passing anything else gives undefined
behavior.
>
how can you print a long long out?
use %qu
>
or have i set it up wrong?
>
also, out of interest, what's the maximum value of a unsigned long
>
long?
The C standard guarantees that unsigned long long can hold values at
least as large as (2^64 - 1)
--
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.