Hi, I noticed the following bug while using R version 1.7.0 for Windows (and Linux):> floor(log10(1000))[1] 2>Here are my start-up messages: R : Copyright 2003, The R Development Core Team Version 1.7.0 (2003-04-16) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()' for distribution details. R is a collaborative project with many contributors. Type `contributors()' for more information. Type `demo()' for some demos, `help()' for on-line help, or `help.start()' for a HTML browser interface to help. Type `q()' to quit R. [Previously saved workspace restored] `tseries' version: 0.9-11 `tseries' is a package for time series analysis and computational finance. See `library (help=tseries)' for details. Attaching package 'tseries': The following object(s) are masked from package:chron : is.weekend Hope this helps. Let me know if you need additional information. Alexander Pasman [[alternative HTML version deleted]]
Why is this a bug? If you take apply floor to a number that you expect to be exactly 3, but compute it on a binary computer via logs to base e, you must expect some rounding error. BTW, on my Windows XP machine I do get> floor(log10(1000))[1] 3 There is no bug in R, but your usage of it is potentially dangerous. You might want to ensure your R is up-to-date: version 1.7.1 is current. On Mon, 23 Jun 2003, Alexander Pasman wrote:> Hi, > > I noticed the following bug while using R version 1.7.0 for Windows (and > Linux): > > > > floor(log10(1000)) > [1] 2 > > > > Here are my start-up messages: > > R : Copyright 2003, The R Development Core Team > Version 1.7.0 (2003-04-16) > > R is free software and comes with ABSOLUTELY NO WARRANTY. > You are welcome to redistribute it under certain conditions. > Type `license()' or `licence()' for distribution details. > > R is a collaborative project with many contributors. > Type `contributors()' for more information. > > Type `demo()' for some demos, `help()' for on-line help, or > `help.start()' for a HTML browser interface to help. > Type `q()' to quit R. > > [Previously saved workspace restored] > > > `tseries' version: 0.9-11 > > `tseries' is a package for time series analysis > and computational finance. > See `library (help=tseries)' for details. > > > Attaching package 'tseries': > > > The following object(s) are masked from package:chron : > > is.weekend > > > Hope this helps. Let me know if you need additional information. > > Alexander Pasman > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On 23 Jun 2003 at 20:20, Prof Brian D Ripley wrote:> Why is this a bug? If you take apply floor to a number that you expect to > be exactly 3, but compute it on a binary computer via logs to base e, you > must expect some rounding error. > > BTW, on my Windows XP machine I do get > > > floor(log10(1000)) > [1] 3 >On my windows XP machine (R1.7.1) i get:> floor( log10(1000) )[1] 2 Why this difference between different XP machines? Kjetil Halvorsen
On Tue, 24 Jun 2003, kjetil brinchmann halvorsen wrote:> On 23 Jun 2003 at 20:20, Prof Brian D Ripley wrote: > > > Why is this a bug? If you take apply floor to a number that you expect to > > be exactly 3, but compute it on a binary computer via logs to base e, you > > must expect some rounding error. > > > > BTW, on my Windows XP machine I do get > > > > > floor(log10(1000)) > > [1] 3 > > > > On my windows XP machine (R1.7.1) i get: > > > floor( log10(1000) ) > [1] 2 > > > Why this difference between different XP machines?Different DLLs, no doubt. Possibly also different chips. The real question is why *you* expected them to be the same? -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Tue, 24 Jun 2003 15:26:56 -0400, "kjetil brinchmann halvorsen" <kjetil@entelnet.bo> wrote in message <3EF86DC0.5086.57E9D@localhost>:>On 23 Jun 2003 at 20:20, Prof Brian D Ripley wrote:>> BTW, on my Windows XP machine I do get >> >> > floor(log10(1000)) >> [1] 3 >> > >On my windows XP machine (R1.7.1) i get: > >> floor( log10(1000) ) >[1] 2 > > >Why this difference between different XP machines?I can guess two possibilities: 1. One of you is using the binary I compiled, the other is using something different. Since mine shows 2 as the answer, I think Kjetil might be using mine. 2. One of you has had the floating point precision reduced by some buggy DLL or video driver. There are probably other explanations. The calculation is inherently unstable; it might be that Brian did it under a different phase of the moon, and that's why he got the "right" answer. Duncan Murdoch