[Rd] potential r bug (floor)

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Jun 23 21:20:04 MEST 2003


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 at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at 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



More information about the R-devel mailing list