• 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: Easy way to truncate floats?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easy way to truncate floats?


  • Subject: Re: Easy way to truncate floats?
  • From: "Kenneth C. Dyke" <email@hidden>
  • Date: Tue, 14 Jan 2003 21:44:27 -0800

Try using %g instead of %f.

-Ken

On Tuesday, January 14, 2003, at 09:29 PM, Sheehan Olver wrote:

I'm writing a program that displays an equation, where some numbers are stored as doubles. This means that, with a format of @"%f", I get equations like "x^2.000000" instead of the desired result of "x^2". Is there any way to trim off the trailing zeros? _______________________________________________
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.


Kenneth Dyke, email@hidden (personal), email@hidden (work)
Sr. Mad Scientist, MacOS X OpenGL Group, Apple Computer, Inc.
Java: The blazing speed of SmallTalk with the simple elegance of C++.
_______________________________________________
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: 
 >Easy way to truncate floats? (From: Sheehan Olver <email@hidden>)

  • Prev by Date: Re: Delete Icon
  • Next by Date: Re: Custom bundle extension
  • Previous by thread: Easy way to truncate floats?
  • Next by thread: Custom bundle extension
  • Index(es):
    • Date
    • Thread