realbasic-nug
[Top] [All Lists]

Re: Re: Math Error?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Re: Math Error?
From: Robert Delaney <delaneyrm at earthlink dot net>
Date: Sun, 30 Jul 2006 16:13:42 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=eoCIwVez7VDV7ivdNe0JG45MWM9IETz77zFg/YmHQG6bRE/d2qLwRNjavR1kv5Nh; h=Received:Mime-Version:Message-Id:In-Reply-To:References:Date:To:From:Subject:Content-Type:X-ELNK-Trace:X-Originating-IP;
References: <380-22006742718323878 at M2W019 dot mail2web dot com> <F665B7DE-FA16-4F85-9085-4DCA4BF9908F at great-white-software dot com> <4e876156bf99eb94e0231e9a75129892 at satx dot rr dot com> <17537608-DB15-4E71-87AA-3B14CE95720B at great-white-software dot com> <577F15C8-B613-4FC8-B432-5CBBB289C4DB at mobleybros dot com> <77124270607280735o5557bae0m43f7eaed10bc6b3d at mail dot gmail dot com> <249055E1-7CBA-4AB1-9EFB-E06802C4F2D6 at mobleybros dot com> <77124270607280753u7757538fu894d9b3842d3285f at mail dot gmail dot com> <6AFF53B6-3984-46DD-9519-88270136C6E9 at great-white-software dot com> <77124270607280935j5c5708aco68c5a25c7b03747f at mail dot gmail dot com>
At 12:35 PM -0400 7/28/06, Peter K. Stys wrote:
Actually we're both right and wrong:

In[55]:=RealDigits[0.036,2,100]

Out[55]={{1,0,0,1,0,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,1,
   1,1,0,1,1,1,1,1,0,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},-4}

Shows that 0.036 can be represented exactly in binary, but requires 51
significant digits (if I counted correctly to the last 1).  So with a
64 bit double, it probably just missed the # of digits in the mantissa
to represent 0.036 exactly.


I couldn't reply in this thread in a timely manner because of a change in earthlink's SMTP server which prevented me from sending any email.

The above binary representation of .036 is incorrect. My Base Converter application shows and verifies that to 100 binary point places the correct representation is:

..000010010011011101001011110001101010011111101111100111011011001000101101000011100101011000000100001

So the first part of Out[55] is correct, but the final group of all zeroes is not. I saw that someone else has proven that .036 requires an infinite number of binary point places for an exact representation ..

Base Converter is a Universal Cocoa application for Mac OS X only. It's freeware and can be found at:

http://homepage.mac.com/delaneyrm/BaseConverter.html

I wrote it to develop my Cocoa skills. If there's any demand I'll write a REALbasic version.

Bob
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>