Float behaviour
Float behaviour
- Subject: Float behaviour
- From: Richard Gray <email@hidden>
- Date: Mon, 22 Aug 2005 18:19:39 +0100
Hi all...
I'm new to Cocoa and Objective C and have just been running through
the Currency Converter example on developer.apple.com. That seemed
fairly straightforward and the application runs, but I notice some
strange behaviour in it that I haven't seen mentioned anywhere else.
If I were to convert $1 at an exchange rate of 1.2, I'd expect to get
1.2 units of the new currency yes? According to my currency converter
however, 1 x 1.2 = 1.200000047683716
Can someone explain this behaviour to me and how to avoid it? I wrote
another small app that takes an number entered into 1 text field and
writes it to another when I press a button. It shows the same
behaviour.
I'm sure there's a simple explanation for this, but I'm just not
seeing at the moment.
thanks!
Richard
_______________________________________________
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