Re: Possible bug in Floor function?

*To*: mathgroup at smc.vnet.net*Subject*: [mg132353] Re: Possible bug in Floor function?*From*: Richard Fateman <fateman at cs.berkeley.edu>*Date*: Mon, 17 Feb 2014 23:04:55 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net*References*: <ldpd8v$6n8$1@smc.vnet.net>

On 2/15/2014 8:02 PM, Bill Rowe wrote: > On 2/15/14 at 4:02 AM, s.nesseris at gmail.com (psycho_dad) wrote: > >> I think I may have stumbled upon a possible bug in Floor. Evaluating >> the following gives the correct result: > >> Floor[Log[10, 100.]] >> 2 > >> Evaluating it with a replacement and //N gives a message and the >> wrong result: > >> Floor[Log[10, x]] /. x -> 100 // N > >> 1 > > The problem isn't with Floor. The issue is simply the usage of > machine precision arithmetic. That is > > In[11]:= RealDigits[Log[10, x] /. x -> 100 // N] > > Out[11]= {{1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},1} > > As you can see, the result is just slightly less than 2. So, the > result Floor returns is correct > > The bug in not in Log, either. 4.605170185988092/2.302585092994046 appears to return 2, but InputForm[%] is 1.9999999999999998 Those two numbers above are InputForm[Log[100.]] and InputForm[Log[10.]], but that is incidental. They can be produced in other ways, including just typing them in. The problem seems to be not that Mathematica cannot compute Floor. It appears the problem is that Mathematica cannot divide. :)