• 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: Round a float
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Round a float


  • Subject: Re: Round a float
  • From: Stefan Wiesendanger <email@hidden>
  • Date: Mon, 28 Jul 2003 17:56:28 +0200

man 3 printf

(although a list in a book might be a bit simpler to understand ;-)


On Montag, Juli 28, 2003, at 05:31 PM, Jonathan E. Jackel wrote:

Try %.1f (note the decimal point after the %). The number after the decimal
point specified the number of decimal places.

You would do well to get a list of the printf formatting tokens from a C
book (Kernighan & Ritchie would be best) or some other source. NSLog and
stringWithFormat: use those tokens.

Jonathan

-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of Lorenzo
Sent: Monday, July 28, 2003 9:41 AM
To: email@hidden
Subject: Round a float


Hi,
I have a
float floatSize = 105.55791;
and I would like to print it as @"105.5";

I tried this
NSLog(@"round 0.0f", floatSize);
but it didn't work as I expected.

Any suggestion?


Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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: Round a float (From: "Jonathan E. Jackel" <email@hidden>)

  • Prev by Date: RE: Round a float
  • Next by Date: Re: Round a float
  • Previous by thread: RE: Round a float
  • Next by thread: Re: Round a float
  • Index(es):
    • Date
    • Thread