Re: doubles not behaving
Re: doubles not behaving
- Subject: Re: doubles not behaving
- From: Gregory Weston <email@hidden>
- Date: Sun, 13 Jun 2004 13:13:46 -0400
On Jun 13, 2004, at 12:11 PM, Gwynne wrote:
On Jun 13, 2004, at 11:25 AM, Gregory Weston wrote:
Ok, maybe i am missing something here but why does
this not output the same thing as the input?
double num = [serial doubleValue];
NSLog(@"Serial = %d", num);
%d is the format specifier for ints and long ints. %f is for floats
and
doubles.
%f is for floats.
%lf is for doubles.
No. %f and %F are for doubles. %lf is invalid
That had better not be the case. From ISO 9899:1999:
l (ell) Specifies that a following d, i, o, u, x, X, or n
conversion specifier applies
to an argument with type pointer to long int or unsigned
long int; that a
following a, A, e, E, f, F, g, or G conversion specifier
applies to an argument
with type pointer to double; or that a following c, s, or [
conversion specifier
applies to an argument with type pointer to wchar_t.
Happily a quick experiment in Xcode indicates that %lf works quite well.
(and though %Lf is valid, it's not implemented and is equivelant to
%f).
Also problematic, but only in the abstract right now since double and
long double are the same size with mainstream tools.
G
_______________________________________________
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.