MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: was: All we have is integers.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117845] Re: was: All we have is integers.
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Fri, 1 Apr 2011 02:35:44 -0500 (EST)
  • References: <201103310905.EAA04898@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

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 at 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 at yahoo.com


  • Prev by Date: Re: Capture values that Min(imize)
  • Next by Date: Re: why extending numbers by zeros instead of dropping precision is a good idea
  • Previous by thread: Re: Capture values that Min(imize)
  • Next by thread: Re: why extending numbers by zeros instead of dropping precision is a good idea