Mathematica 9 is now available
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 Withoff <withoff>
  • Date: Wed, 25 Mar 1992 22:01:03 -0600

> I am running Mathematica 2.0 on a Sparcstation 1+.
> 
> Ceiling[10^30 + 3.333] returns 1000000000000000019884624838656
> 
> Similarly for Floor[].  Is this a known bug?
> 
> Ferrell Wheeler
> wheeler at super.org

One useful thing that Ceiling[10^30 + 3.333] could do is generate
a warning message.  The only meaningful ceiling of 10^30+3.333 is
buried in the uncertainty of the number.  A similar problem occurs
with Floor, Round, and Mod:

In[6]:= Mod[10^30 + 3.333, 2]

Out[6]= 0.

An elegant implementation of such a message is a bit tricky, since it isn't
easy to tell when the last few bits of an inexact number represent integer
differences.  If we are satisified with a certain amount of numerical fuzz
it's not too bad.  Roughly (very roughly!) :

In[17]:= Ceiling[e_Real] := $Failed /; Log[10, e] > $MachinePrecision

In[18]:= Ceiling[10^30 + 3.333]

Out[18]= $Failed

Other suggestions?

Dave Withoff
withoff at wri.com





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