Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

Re: Ceiling & Floor

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Ceiling & Floor
  • From: David Sibley <sibley at math.psu.edu>
  • Date: Wed, 25 Mar 92 20:47:07 -0500

> Ceiling[10^30 + 3.333] returns 1000000000000000019884624838656
> 
> Similarly for Floor[].  Is this a known bug?
> 
> Ferrell Wheeler
> wheeler at super.org
> 

Not a bug. A misunderstanding of how Precision and Accuracy work in
Mathematica. To quote the manual, "Mathematica", Second Edition, page
544:

"Whenever machine-precision numbers appear in a calculation, the whole
calculation is typically done in machine precision. Mathematica will
then give machine-precision numbers as the result."

This is followed by several examples. Numbers like 3.333 are considered
to be machine-precision. That's 16 digits on my Sparcstation, and
apparently on yours, too.

Anyway, in your example this means even the 10^30 is calculated to only
16 digits. Adding 3.333 does not then change the value, as that's
outside the range of correct digits of the 10^30 as calculated. There
are examples of this phenomenon in the manual, too.

There are several ways around this, if that's what you're looking for.
If the 3.333 is more accurate than it appears to be, you just have to
tell Mathematica that. One way is to use

    10^30 + SetPrecision[3.333,31]

and another is to use

    10^30 + 3333/1000

I recommend you get and read the manual. It's very useful and well
worth the price.


David A. Sibley
sibley at math.psu.edu





  • Prev by Date: Re: Nodal
  • Next by Date: Re: Ceiling & Floor
  • Previous by thread: Ceiling & Floor
  • Next by thread: Re: Ceiling & Floor