Re: Puzzled by IntegerPart
- To: mathgroup at smc.vnet.net
- Subject: [mg114681] Re: Puzzled by IntegerPart
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 13 Dec 2010 03:50:17 -0500 (EST)
On 12 Dec 2010, at 11:40, Themis Matsoukas wrote:
> Round and Rational have solved the problem. But I am curious, why do the phantom decimals not show with N?
>
> N[100*1.15, 20]
>
> 115.
>
>
> Themis
>
This does not make sense (in Mathematica). 100*1.15 is a machine precision number:
In[55]:== Precision[100*1.15]
Out[55]== MachinePrecision
and applying N[?,20] to a MachinePrecision number does nothing at all. If you want a to convert it to a higher precision number as output you should use:
SetPrecision[100*1.15, 20]
114.99999999999998579
If you only want to pad the output with zeros you can do:
NumberForm[100*1.15,{3,17}]
115.00000000000000000
All of this is actually fully documented.
Andrzej Kozlowski