Re: why are floats flakey?
Re: why are floats flakey?
- Subject: Re: why are floats flakey?
- From: Nathan Day <email@hidden>
- Date: Tue, 25 May 2004 14:57:05 +1000
floats (finite number of binary places) can't represent 2997/100 for the same reason decimal numbers of a finite number of decimal places can't represent 1/3.
On Tuesday, May 25, 2004, at 12:23PM, justin webster <email@hidden> wrote:
>
why are floats inaccurate?
>
when can I use them with confidence and what can I use in their place
>
when I need absolute accuracy?
>
>
i'm trying to create a float with a value of 29.97 and I get 29.9699999
>
like this:
>
float myFloat = [myTextField floatValue]
>
where the text field contains the string "29.97df"
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
>
>
>
Nathan Day
email@hidden
http://homepage.mac.com/nathan_day/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.