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: [mg114618] Re: Puzzled by IntegerPart
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Fri, 10 Dec 2010 02:31:24 -0500 (EST)

On 12/9/10 at 6:00 AM, tmatsoukas at me.com (Themis Matsoukas) wrote:

>IntegerPart[100*1.15]

>114

In[2]:= RealDigits[100*1.15]

Out[2]= {{1,1,4,9,9,9,9,9,9,9,9,9,9,9,9,9},3}

This is the nature of machine precision arithemtic. Perhaps you
should use

In[3]:= Rationalize[100*1.15]

Out[3]= 115

or

In[4]:= Round[100*1.15]

Out[4]= 115



  • Prev by Date: Re: Puzzled by IntegerPart
  • Next by Date: How to invert a function of several variables?
  • Previous by thread: Re: Puzzled by IntegerPart
  • Next by thread: Re: Puzzled by IntegerPart