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: "Peter K. Stys" <pkstys at gmail dot com>
Date: Fri, 28 Jul 2006 12:35:56 -0400
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=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g4BEYyMYU7i7QjleqyKEmhrfZrs0y3tByGWp3YlzzVc3uhKK8FTvhoKuj9w3PeRXTn0v9KJH44tiE37iabEkjxg6WL9n8oRoM9PCrJXO55FmTUp0cwIkDdlSCXjIGgFSPZverf5KP5k+DBox6rPKSBUKKXBFv7e1tx714levfk0=
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>
On 7/28/06, Norman Palardy <npalardy at great-white-software dot com> wrote:

On Jul 28, 2006, at 8:53 AM, Peter K. Stys wrote:

>
> In[26]:= N[72/2000*750,100]
>
> Out[26]=
> 27.0000000000000000000000000000000000000000000000000000000000000000000
> 0000000000000000000000000000000
>
> In[27]:= N[72/2000*750]
>
> Out[27]= 27.
>
> Still suggests all these numbers and intermediate results are
> representable exactly at machine precision.

I'm quite certain that 72/2000 is not.
Write it as the simple sum of powers of 2 and you find the problem.
72/2000 = 2^-2 + 2^-4 + 2^-5 + 2^-6 + 2^-11 + 2^-15 ..... and so on
and you never get exactly the result you get from 72/2000.
In the machine all you have is powers of 2



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.
Nuf time wasted on this, just a curiosity.

P.

--
-------------------------------------------------------------------------------
Peter K. Stys, MD
Professor of Medicine(Neurology), Senior Scientist
Ottawa Health Research Institute, Div. of Neuroscience
Ottawa Hospital / University of Ottawa
Ontario, CANADA
tel:    (613)761-5444
fax:    (613)761-5330
http://www.ohri.ca/profiles/stys.asp
-------------------------------------------------------------------------------
_______________________________________________
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>


From  Fri 28 Jul 2006 10:36:18 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id 9970F8CC6B0; Fri, 28 Jul 2006 09:36:45 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on realxserve.local
X-Spam-Level: X-Spam-Status: No, score=-2.7 required=4.5 tests=AWL,BAYES_00,NO_REAL_NAME autolearn=no version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
        by xmail.realsoftware.com (Postfix) with ESMTP id 9DEE78CC6AA;
        Fri, 28 Jul 2006 09:36:44 -0700 (PDT)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id DDC2813D6062; Fri, 28 Jul 2006 11:36:32 -0500 (CDT)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from swarthymail-a5.dreamhost.com (sd-green-bigip-61.dreamhost.com
        [208.97.132.61])
        by lists.realsoftware.com (Postfix) with ESMTP id 56A2013D6053
        for <realbasic-nug at lists dot realsoftware dot com>;
        Fri, 28 Jul 2006 11:36:26 -0500 (CDT)
Received: from [66.116.103.197] (unknown [66.116.103.197])
        by swarthymail-a5.dreamhost.com (Postfix) with ESMTP id ADBF1109EAE
        for <realbasic-nug at lists dot realsoftware dot com>;
        Fri, 28 Jul 2006 09:36:25 -0700 (PDT)
Date: Fri, 28 Jul 2006 10:36:18 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <40eddf340607280832r29179987y3b439b714e8f20a3 at mail dot gmail dot 
com>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060728163625 dot ADBF1109EAE at swarthymail-a5 dot dreamhost dot 
com>
Subject: Re: RBScript
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

On Jul 28, 2006, at 15:32 UTC, Walter Purvis wrote [regarding the use of 
RBScript]:

I am discouraged by the likely
futility of it all, given the crashing bugs, the general and
completely baffling neglect on the part of REAL, and (which follows)
the absence of things like PartialRun and decent threading/yielding
behavior that would be needed in most (albeit not all) applications of
RBScript that I've ever had in mind.

Agreed.  Though it hasn't been *completely* neglected -- it has become an 
integral part of the IDE, so hopefully this means it will get a bit more 
attention.

My understanding was that Swordfish... was going to use RBScript.

I don't know where you got that idea.  It certainly was not my understanding.

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
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>