Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16571

Re: Possible bug in Floor function?

From Richard Fateman <fateman@cs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Possible bug in Floor function?
Date 2014-02-18 03:30 +0000
Message-ID <lduk4g$l9j$1@smc.vnet.net> (permalink)
References <ldpd8v$6n8$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On 2/15/2014 8:02 PM, Bill Rowe wrote:
> On 2/15/14 at 4:02 AM, s.nesseris@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.  :)

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar


Thread

Re: Possible bug in Floor function? Bill Rowe <readnews@sbcglobal.net> - 2014-02-16 04:02 +0000
  Re: Possible bug in Floor function? Richard Fateman <fateman@cs.berkeley.edu> - 2014-02-18 03:30 +0000

csiph-web