MathGroup Archive 2004

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

Search the Archive

Re: how to explain this weird effect? Integrate

drbob at (Bobby R. Treat) wrote concerning the bug which causes
Limit[Floor[Cos[x]], x -> 0] to give 1, rather than 0:

> The problem with Floor[Cos[x]] may be related to this situation:
> Floor[1 - 10.^(-17)]
> 1

Thanks. Yes, it might be related to that. But it _shouldn't_ be related
since everything in Limit[Floor[Cos[x]], x -> 0] is _exact_.

BTW, I doesn't trouble me -- well, at least, not much -- that
Floor[1 - 10.^(-17)] yields 1 . I've often mentioned (although perhaps not
in this newsgroup) that using discontinuous functions such as Floor in
floating-point arithmetic is _inherently_ perilous. One needs to learn to
expect things like Floor[1 - 10.^(-17)] possibly being 1 .

OTOH, note that Mathematica correctly gives 0 for Floor[1 - 10^(-17)] .
Since everything there was exact, I would have been greatly troubled if
Mathematica hadn't gotten that right.


  • Prev by Date: Help with Export function
  • Next by Date: Attributes and behaviors?
  • Previous by thread: Re: how to explain this weird effect? Integrate
  • Next by thread: Estimating parameters p and q in y'' + p y' + q y = Tide(t)