RE: Re: Re: Lower Floor
- To: mathgroup at smc.vnet.net
- Subject: [mg39144] RE: [mg39097] Re: [mg39040] Re: [mg39004] Lower Floor
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Fri, 31 Jan 2003 04:36:59 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Selwyn, dear Andrzej, some further observations: In[46]:= Through[{InputForm, Floor}[#]] & /@ Table[SetPrecision[3, prec], {prec, 10 + Log[10, 3.], 23 + 1, 1}] // TableForm Out[46]//TableForm= 3.`10.4771 3 3.`11.4771 3 3.`12.4771 3 3.`13.4771 3 3.`14.4771 3 3.`15.4771 3 3.`16.4771 3 3.`17.4771 3 3.`18.4771 3 3.`19.4771 3 3.`20.4771 3 3.`21.4771 3 3.`22.4771 3 3.`23.4771 3 In[47]:= Through[{InputForm, Floor, FromDigits[RealDigits[#, 2], 2] &}[#]] & /@ ToExpression[Take[NestList[# <> "0" &, "3.", 23], -14]] // TableForm Out[47]//TableForm= 3.0 3 3 3.0 3 3 3.0 3 3 3.0 3 3 3.0 3 3 3.0 3 3 3.0 3 3 2.999999999999999999999999999991459`17.6021 2 3 2.999999999999999999999999999994387`18.6021 2 3 2.999999999999999999999999999988124`19.6021 2 3 2.99999999999999999999999999999999997894`20.6021 2 3 2.99999999999999999999999999999999987137`21.6021 2 3 2.999999999999999999999999999999999943`22.6021 2 3 2.99999999999999999999999999999999988492`23.6021 2 3 In[48]:= (ii = Interval /@ ToExpression[Take[NestList[# <> "0" &, "3.", 23], -14]]) // TableForm Out[48]//TableForm= Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{2.99999999999999999, 3.00000000000000001}] Interval[{2.999999999999999999, 3.000000000000000001}] Interval[{2.9999999999999999999, 3.0000000000000000001}] Interval[{2.99999999999999999999, 3.00000000000000000001}] Interval[{2.999999999999999999999, 3.000000000000000000001}] Interval[{2.9999999999999999999999, 3.0000000000000000000001}] Interval[{2.99999999999999999999999, 3.00000000000000000000001}] In[50]:= InputForm[(10^((#1 + #2)/2))] & @@@ Log[10, Flatten[List @@@ ii, 1]] Out[50]= {2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.999999999999999999995164569285922`17.6002, 2.999999999999999999999398436196254`18.6003, 2.999999999999999999999997528327083`19.6003, 2.999999999999999999999997528966012`20.6003, 2.999999999999999999999997529010859`21.6003, 2.99999999999999999999999999063078546595`22.6003, 2.99999999999999999999999999063078491591`23.6003} Some differences in detail notwithstanding, this gives an idea of how the inputs are treated! See also the differences for machine numbers. In particular this explains Floor[3.0...0] == 2 for any Input with more than 16 zeros trailing. Oh, I nearly forgot, look at BaseForm[#, 2] & /@ ToExpression[Take[NestList[# <> "0" &, "3.", 23], -14]] // TableForm -- Hartmut Wolf >-----Original Message----- >From: Andrzej Kozlowski [mailto:andrzej at bekkoame.ne.jp] To: mathgroup at smc.vnet.net >Sent: Wednesday, January 29, 2003 3:11 PM >To: Selwyn Hollis; Hartmut.Wolf at t-systems.com >Cc: mathgroup at smc.vnet.net >Subject: [mg39144] Re: [mg39097] Re: [mg39040] Re: [mg39004] Lower Floor > > >But at least it seems to be just the question of the way you input >them. If instead of typing typing 20 zeros you simply enter 3.`20 >everything works fine: > > >Floor[3.`20] > >3 > >It also saves you some typing! > >Andrzej Kozlowski >Yokohama, Japan >http://www.mimuw.edu.pl/~akoz/ >http://platon.c.u-tokyo.ac.jp/andrzej/ > > > >On Wednesday, January 29, 2003, at 05:37 PM, Selwyn Hollis wrote: > >> I realize that we're dealing with the vagaries of internal >arithmetic, >> but it is highly disquieting that 3.000... (with any number of zeros) >> would ever be anything but the binary floating-point number >.11 * 2^2 ! >> >> Selwyn >> >> >> On Monday, January 27, 2003, at 02:55 AM, Wolf, Hartmut wrote: >> >>> Selwyn, >>> >>> things aren't, what they appear to be: >>> >>> In[2]:= Through[{InputForm, Floor}[#]] & /@ >>> {3.0000000000000000, 3.00000000000000000} >>> Out[2]= {{3., 3}, >>> {2.999999999999999999999999999991459`17.6021, 2}} >>> >>> You're right, of course, perhaps, except for wow. >>> >>> -- >>> Hartmut >>> >>> >>>> -----Original Message----- >>>> From: Selwyn Hollis [mailto:selwynh at earthlink.net] To: mathgroup at smc.vnet.net >> To: mathgroup at smc.vnet.net >>>> Sent: Saturday, January 25, 2003 7:27 AM >>>> To: mathgroup at smc.vnet.net >>>> Subject: [mg39144] [mg39097] [mg39040] Re: [mg39004] Lower Floor >>>> >>>> >>>> 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! >>>>> >>>>> >>>> >>>> >>> >> >> >> >> >