Re: Possible bug in Floor function?
- To: mathgroup at smc.vnet.net
- Subject: [mg132349] Re: Possible bug in Floor function?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 15 Feb 2014 23:14:57 -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
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