• 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: Richard Gray <email@hidden>
  • Date: Tue, 23 Aug 2005 18:30:34 +0100

Thanks for all the responses...

I actually just discovered the NSNumberFormatter while mucking around
with the interface for a new app I'm playing with.

I'll have a play with formatted strings too and see what works best for me.

ta!
Richard



On 8/23/05, Todd Yandell <email@hidden> wrote:
>
>
> 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

References: 
 >Float behaviour (From: Richard Gray <email@hidden>)
 >Re: Float behaviour (From: Todd Yandell <email@hidden>)

  • Prev by Date: Re: Core Data and undo action names
  • Next by Date: Re: NSOpenPanel (and Finder and Nav Serv) previews, adding support for my own file types?
  • Previous by thread: Re: Float behaviour
  • Next by thread: Re: Float behaviour
  • Index(es):
    • Date
    • Thread