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