Re: Float behaviour
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