Re: doubles not behaving
Re: doubles not behaving
- Subject: Re: doubles not behaving
- From: Gwynne <email@hidden>
- Date: Sun, 13 Jun 2004 12:11:24 -0400
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 (and though %Lf is valid,
it's not implemented and is equivelant to %f). There is no difference
between %f and %F; %f is the preferred form. There is no specifier
reserved for floats specifically; use %f for both floats and doubles.
From the printf(3) manpage:
fF The double argument is rounded and converted to decimal
notation
in the style [-]ddd.ddd, where the number of digits after
the
decimal-point character is equal to the precision
specification.
-- Gwynne, key to the Code that runs us all
Formerly known as Sailor Quasar.
Email: email@hidden
Web:
http://musicimage.plasticchicken.com/
_______________________________________________
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.