MathGroup Archive 2009

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

Search the Archive

Re: Unexpected behavior of Floor and IntegerPart

On 3/24/09 at 5:32 AM, cfo at (Curtis Osterhoudt) wrote:

>I'm sure this is a result of non-infinite-precision arithmetic, but
>it would be nice to have a more consistent behavior:

>In[26]:= IntegerPart[0.29*100]

>Out[26]= 28

<more tests/examples snipped>

Yes, the behavior you are seeing is due to using machine
precision numbers. If by consistent you mean you want
consistency between the results obtained using machine precision
numbers and exact numbers that isn't possible. The difference is
an aspect of the way computers are designed and work. This
difference can be overcome by Mathematica either by converting
the machine precision numbers to exact numbers or increasing the
precision beyond machine precision. Of course there is a cost to
increasing precision in terms of performance time.

  • Prev by Date: Re: SetDelayed::write ... [x_] is protected
  • Next by Date: Re: solving nonlinear simultaneous equations
  • Previous by thread: Unexpected behavior of Floor and IntegerPart
  • Next by thread: Re: Unexpected behavior of Floor and IntegerPart