Re: Re: Lower Floor
- To: mathgroup at smc.vnet.net
- Subject: [mg39051] Re: [mg39040] Re: [mg39004] Lower Floor
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 26 Jan 2003 05:22:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
All of this is a result of the "optical illusion" produced by working in StandardForm. Here is how it works: In[1]:= x=SetPrecision[3,20] Out[1]= 3.0000000000000000000 In[2]:= y=3.00000000000000000000 Out[2]= 3.00000000000000000000 So x and y seem identical. However: In[3]:= Floor[x] Out[3]= 3 In[4]:= Floor[y] Out[4]= 2 A paradox? Let's look at InputForm (or FullForm if you prefer): In[5]:= x//InputForm Out[5]//InputForm= 3.`20 In[6]:= y//InputForm Out[6]//InputForm= 2.99999999999999999999999999999999997894`20.6021 You can check that this does not happen when you use floating point arithmetic (replace 20 digits of precision above by, say, 16). The reason for this is, I think, that Mathematica's internal extended arithmetic is binary and not decimal. I suppose this is not the case for the built in hardware floating point arithmetic. Of course there is an illusion involved here. In fact: On Saturday, January 25, 2003, at 03:26 PM, Selwyn Hollis wrote: > Wow. But apparently it has nothing to do with Log. Look: > > Floor[3.0000000000000000] > > 3 > > Floor[3.00000000000000000] > > 2 > > --- > Selwyn Hollis > > > > On Friday, January 24, 2003, at 05:05 AM, André Giroux wrote: > >> Hi All. >> With Mathematica 4.1 on Windows98: >> N[Log[8]/Log[2]] >> 3. >> Floor[N[Log[8]/Log[2]]] >> 2 >> Beware! >> >> > > > > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/