[Rd] bug in pretty() (PR#1032)
Prof Brian Ripley
ripley@stats.ox.ac.uk
Wed, 25 Jul 2001 20:41:34 +0100 (BST)
On Wed, 25 Jul 2001 deepayan@stat.wisc.edu wrote:
>
>
>
> I have the following output from pretty():
>
>
> > pretty(c(-.1, 1)) # note 2nd element
> [1] -2.000000e-01 -2.775558e-17 2.000000e-01 4.000000e-01 6.000000e-01
> [6] 8.000000e-01 1.000000e+00
> > as.character(pretty(c(-.1, 1)))
> [1] "-0.2" "-2.77555756156289e-17" "0.2"
> [4] "0.4" "0.6" "0.8"
> [7] "1"
>
>
> The root cause seems to be here:
>
>
> > 1.2/6 - .2
> [1] -2.775558e-17
You can't expect exact arithmetic. Using as.character is almost never a
good idea. I don't think this is a bug, but you should be doing something
more complex if you want to make labels here.
> (It seems that this is not a problem in all installations.)
>
>
> <<insert bug report here>>
!!
>
> --please do not edit the information below--
>
> Version:
> platform = i686-pc-linux-gnu
> arch = i686
> os = linux-gnu
> system = i686, linux-gnu
> status =
> major = 1
> minor = 3.0
> year = 2001
> month = 06
> day = 22
> language = R
>
> Search Path:
> .GlobalEnv, package:ctest, Autoloads, package:base
>
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._