Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Puzzled by IntegerPart

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114683] Re: Puzzled by IntegerPart
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 13 Dec 2010 03:50:38 -0500 (EST)

N can reduce precision but it cannot increase precision.

100*1.15 // InputForm

114.99999999999999

% // Precision

MachinePrecision

N[%%, 20] // InputForm

114.99999999999999

% // Precision

MachinePrecision

SetPrecision[100*1.15, 30]

114.999999999999985789145284798

Precision[%]

30.

N[%%, 20]

114.99999999999998579

Precision[%]

20.


Bob Hanlon

---- Themis Matsoukas <tmatsoukas at me.com> 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




  • Prev by Date: Re: Replacement Rule with Sqrt in denominator
  • Next by Date: Construction of schedules for the inequality decision
  • Previous by thread: Re: Puzzled by IntegerPart
  • Next by thread: Re: Puzzled by IntegerPart