MathGroup Archive 1992

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

Search the Archive

Re: Ceiling & Floor


	> Ceiling[10^30 + 3.333] returns 1000000000000000019884624838656

This is NOT a bug.

In[3]:= 10^30 + 3.333

             30
Out[3]= 1. 10

In[4]:= MachineNumberQ[%]

Out[4]= True

In[5]:= $NumberBits[%%]

Out[5]= {1, {}, {1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 
 
>     1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 
 
>     0, 1, 1, 1, 0, 1, 0, 1, 0, 0}, 100}

In[6]:= SetPrecision[%%%, 40]

					   30
Out[6]= 1.000000000000000019884624838656 10

Arithmetic with machine numbers results in machine numbers (unless the result
can't be expressed as a machine number due to overflow or underflow.)
53 or 64 (or whatever your machine happens to use) bits is insufficient
to give any digits to the right of the decimal point.  Ceiling[ ] and Floor[ ]
have nothing to do with it.

Jerry B. Keiper
keiper at wri.com





  • Prev by Date: Re: Ceiling & Floor
  • Next by Date: Re: converting a number in base b to a number in base 10 using ^^ in Mathematica
  • Previous by thread: Re: Ceiling & Floor
  • Next by thread: Nodal