MathGroup Archive 2010

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

Search the Archive

Re: Puzzled by IntegerPart

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114640] Re: Puzzled by IntegerPart
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 11 Dec 2010 01:54:30 -0500 (EST)

On 12/10/10 at 2:29 AM, mathgroup at stein.org (James Stein) wrote:

>The puzzle is easily solved by observing that the fractional part is
>greater than zero, verified by the fact that this input:
>FractionalPart [ 1.15*100 ] > 0
>returns 'True".

>More seriously, documentation for both IntegerPart and
>FractionalPart, in "Possible Issues", warns about potential
>precision problems.  However, your expression is so apparently
>innocent that one wonders why Mathematica cannot do better...

Mathematica can do better. But only if you make use of higher
precision routines that are available in Mathematica. However,
you should be aware there is a trade to be made. If you use
machine precision, Mathematica can do no better than what the
hardware in your machine allows. And by using machine precision,
arithmetic is done by hardware thereby maximizing performance.

You can do things with higher precision than allowed by your
hardware by making use of the arbitrary precision routines
Mathematica offers. But this means arithmetic is being done in
software by Mathematica. So while you gain in precision you give
up some amount of performance.

It is up to each user to decide whether they want higher
performance or higher precision.



  • Prev by Date: Re: Help me find a probability distribution
  • Next by Date: Question: Compile in Mathematica 8.0
  • Previous by thread: Re: Puzzled by IntegerPart
  • Next by thread: Re: Puzzled by IntegerPart