MathGroup Archive 2007

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

Search the Archive

Re: {Precision@N[2^1024],N[2^1024]===$MaxMachineNumber}

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80729] Re: [mg80685] {Precision@N[2^1024],N[2^1024]===$MaxMachineNumber}
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Thu, 30 Aug 2007 02:35:29 -0400 (EDT)
  • References: <200708290810.EAA26797@smc.vnet.net>

Chris Chiasson wrote:
> on my computer, this command gives
> {15.9546,False}
> 
> However, I think the result is supposed to be
> {MachinePrecision,True}
> 
> Is there something wrong with N?

Not in this example.

Looking at the bit pattern of $MaxMachineNumber should give an idea of 
what it actually is.

In[14]:= InputForm[rr = RealDigits[$MaxMachineNumber,2]]

Out[14]//InputForm=
{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 1024}

In[18]:= Length[rr[[1]]]

Out[18]= 53

So we have a string of 53 1's, to the right of the radix, times 2^1024. 
To get an integer equivalent one would do

In[19]:= ii = Sum[2^j, {j,1024-53,1024-1}];

In[20]:= N[ii]===$MaxMachineNumber
Out[20]= True


> My computer is an Athlon XP running Windows XP SP2.
> 
> Also, why does
> ByteCount@$MaxMachineNumber
> give
> 16
> ? I'm sure I am missing something, but I thought a double precision
> floating point number would only take up 8 bytes.
> 
> Thanks.
> 

The floating point number requires 8 bytes and, as every Mathematica 
entity is stored in an "expr" construct with various fields, the other 8 
bytes are the expr overhead.


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: {Precision@N[2^1024],N[2^1024]===$MaxMachineNumber}
  • Next by Date: GraphicsGrid bug and work around
  • Previous by thread: {Precision@N[2^1024],N[2^1024]===$MaxMachineNumber}
  • Next by thread: Re: {Precision@N[2^1024],N[2^1024]===$MaxMachineNumber}