• 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: 1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter


  • Subject: Re: 1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter
  • From: Ricky Sharp <email@hidden>
  • Date: Mon, 17 Jan 2005 06:43:42 -0600

On Monday, January 17, 2005, at 00:56AM, R.Claeson <email@hidden> wrote:

>
>On 17 Jan 2005, at 07:44, NOYFB wrote:
>
>> I just completed the Dev Connection tutorial CurrencyConverter
>>
>> http://developer.apple.com/documentation/Cocoa/Conceptual/
>> ObjCTutorial/chapter01/chapter_1_section_1.html#//apple_ref/doc/uid/
>> 20001101.
>>
>> When I enter
>>
>> 1.4 x 1 = 1.450000047683716 should be 1.45
>> 1.1 x x = 1.100000023841858 Should be 1.1
>> 1 x 1 = 1 Ok.
>>
>> I do not think this is normal or maybe it is and there is extremely
>> good explanation to use setFloatingPointFormat.
>>
>> Pleas confirm If it's a bug or that I have to specify some sort of
>> flag/option?
>
>It's not a bug. It's just that floating point variables has never been
>a particularly good choice for representing decimal values with great
>(or even some kind of) accuracy.

Accuracy isn't the issue here; it's precision.

Working with floating point values has been a recent thread on this list.  You ultimately should either pick up a book on, or attend a course on, "Numerical Analysis".

--
Rick Sharp
Instant Interactive(tm)

 _______________________________________________
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: 
 >1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter (From: NOYFB <email@hidden>)
 >Re: 1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter (From: "R.Claeson" <email@hidden>)

  • Prev by Date: Re: how to create webloc file in programming?
  • Next by Date: Re: how to create webloc file in programming?
  • Previous by thread: Re: 1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter
  • Next by thread: Re: 1.45 x 1 = 1.450000047683716 ? :: CurrencyConverter
  • Index(es):
    • Date
    • Thread