• 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: Float behaviour
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Float behaviour


  • Subject: Re: Float behaviour
  • From: Todd Yandell <email@hidden>
  • Date: Mon, 22 Aug 2005 21:02:30 -0500


On Aug 22, 2005, at 12:19 PM, Richard Gray wrote:

I'm sure there's a simple explanation for this, but I'm just not
seeing at the moment.

As others mentioned, it's because floating point numbers can't be 100% accurate with only 32 bits. There's an easy fix for it, though. Just drop an NSNumberFormatter onto both of your text fields, then choose to show two decimal places. Cocoa automatically rounds for you, and you'll get a nicely formatted two-digit number no matter what the input was. You can find the number formatter in the IB palettes.


Todd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Float behaviour
      • From: Richard Gray <email@hidden>
References: 
 >Float behaviour (From: Richard Gray <email@hidden>)

  • Prev by Date: Re: Code signing
  • Next by Date: bug while saving
  • Previous by thread: Re: Float behaviour
  • Next by thread: Re: Float behaviour
  • Index(es):
    • Date
    • Thread