[Rd] round() doesnt (PR#1138)

p.dalgaard@biostat.ku.dk p.dalgaard@biostat.ku.dk
Tue, 23 Oct 2001 01:20:31 +0200 (MET DST)


Thomas Lumley <tlumley@u.washington.edu> writes:

> On Mon, 22 Oct 2001, David Brahm wrote:
> 
> > Hi, all,
> >
> >    I swear, bug.report() ate my message!  Apologies to all, esp. Peter who
> > will once again have to clean up after my mess...
> >
> >    The bug report was supposed to say:
> >
> > R> round(100000/3, -2) - 33300
> >    [1] -7.275958e-12
> >
> > I would have hoped for 0.  The problem seems to be specifically for negative
> > "digits".
> > 			-- David Brahm (brahm@alum.mit.edu)
> >
> > Version:
> >  platform = sparc-sun-solaris2.6
> >  arch = sparc
> >  os = solaris2.6
> >  system = sparc, solaris2.6
> >  status =
> >  major = 1
> >  minor = 3.0
> 
> ^^^^^^^^
> I can duplicate this under Windows R1.3.0 but not Debian R1.3.1, so it may
> have been fixed.  Looking at the changes to arithmetic.c I don't see why,
> though.

It's an accuracy issue, still there in 1.3.1 for Solaris 7. Basically,
dividing by 10^-2 does not always give an integer on SPARC, so we
should be more careful with the logic in fround.c. Beats me why it
would act up on windows, but, well, ...

[Cc: to r-bugs so that we get it filed properly]

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._