[Date Index] [Thread Index] [Author Index]
Re: Puzzled by IntegerPart
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.