Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1391

Re: was: All we have is integers.

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: was: All we have is integers.
Date 2011-04-01 07:34 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <in3v61$hvp$1@smc.vnet.net> (permalink)
References <201103310905.EAA04898@smc.vnet.net>

Show all headers | View raw


But!

N[7205759403792794 * 2^(-56), 30]

0.100000000000000005551115123126

That is 0.1 only to FINITE precision, and adding binary 0's as you  
suggested doesn't help "a bit":

N[2*7205759403792794  2^(-57), 30]

0.100000000000000005551115123126

> The radix for input and output is a red herring, in my view.  That
> number 72057.... can be written in any radix whatsoever, and so can the
> exponent.  The base here is 2,  but it could be 10, or 16 or 1024 ...

The representation error would be zero in base 10 (in the case of 0.1),  
and generally different from one base to another.

Bobby

On Thu, 31 Mar 2011 04:05:24 -0500, Richard Fateman  
<fateman@eecs.berkeley.edu> wrote:

> On 3/30/2011 4:20 PM, Daniel Lichtblau wrote:
>>
>>>>>> (DL)   In effect you'd be putting garbage right where
>>>>>> you are trying to avoid it.
>>>>
>>>>> (RJF) Nope.  Consider representing the integer 10 as a float.  Do
>>>>> you mind adding decimal zeros or binary zeros to get
>>>>> 10.0000000000000000    ?  Are you adding garbage?  I think not.
>>
>> (DL) I agree with that. But one does not always work with integers. Or
>> with "nice" decimals (defined howsoever you like, provided
>> 1.2345678765998821 is not regarded as "nice").
>
> "God invented the integers; all else is the work of man."  (Kronecker)
>
> Consider that the decimal number 0.1 converted to IEEE double float is
>
> 7205759403792794 x 2^(-56).
>
> These are all integers.  You can add zeros to that by simultaneously
> doubling that first number, the one that starts with 72..  and
> subtracting one from the exponent, the one that starts with -56.  You
> can write a Mathematica program to do this of course.
>
> All the manipulations that you can do with floats can be done with
> (pairs of) integers, along with a bit for the sign.
> So in some sense all you are doing is working with integers, even when
> you think you are doing floating adds, multiplies etc.
> And Mathematica presumably does the moral equivalent of this for its
> software floats.
>
> The radix for input and output is a red herring, in my view.  That
> number 72057.... can be written in any radix whatsoever, and so can the
> exponent.  The base here is 2,  but it could be 10, or 16 or 1024 ...
>
> If you have a number, that's the number that you have.  If you want to
> print it in decimal, rounded to 3 decimal places, then that is a
> formatting operation and should not affect the number.  If you want to
> print it in decimal and read it back in, then you will generally have a
> nearby number, but not necessarily exactly the same number you started
> with.   (If you do this in a cycle, you can find a nearby number that
> can be read in exactly, but that is another story. )
>
>
>


-- 
DrMajorBob@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: was: All we have is integers. DrMajorBob <btreat1@austin.rr.com> - 2011-04-01 07:34 +0000

csiph-web