>Date: Thu, 15 Oct 1998 15:30:22 +0200 >To: Guido Masarotto <guido at sirio.stat.unipd.it> >From: Andrea Rossetti <rossetti at stud.unipg.it> >Subject: probably "round()" bug > >Hi to all R people, >I'm using the Guido Masarotto's compiled R, version 0.62.3. >there is a probably bug in round function, in fact I've done: > >> round(0.5) >[1] 0.5 >> round(-1.5) >[1] -1.5 > >In the documentation is writed: > >......... >round' rounds the values in its first argument to the > specified number of decimal places (default 0). Note > that for rounding off a 5, the IEEE standard is used, > ``go to the even digit''. Therefore `round(0.5)' is > `0' and `round(-1.5)' is `-2'. >......... > >any suggestion is appreciated! > >Andrea Rossetti. >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Martin Maechler
1998-Oct-15 13:59 UTC
[R] Fwd: probably "round()" bug --- in Guido's Win' R 0.62.3
Andrea, this problem does NOT appear on my (Sun Solaris) version of R 0.62.3. It must be a "architecture dependent" (maybe Windows only) bug, triggered by bogous libraries / optimizations, or such things. Here is a mail from the R core development list, of half a year ago. I don't really know the details of what it's about...>> Date: Sun, 15 Feb 1998 09:14:50 +0100 >> From: Kurt Hornik <hornik@ci.tuwien.ac.at> >> To: R-core@stat.math.ethz.ch >> Subject: round() problem >> >> The following problem occurs under ix86 Debian GNU/Linux when compiling >> with optimization turned on: >> >> R> round(0.5) >> [1] 0.5 >> >> etc etc >> >> The problem is eliminated if in src/nmath/fround.c we use the math lib's >> rint() rather than private_rint(), as in the previous versions ... >> >> Is it o.k. to go back to using rint() whereever available? (Do we still >> need to override rint() on hpux?)Note: This is *NOT* CC'ed to R-help (but to R-devel, the "R code experts") with my understanding that finally a SUMMARY or *the* solution will appear on R-help. Best Regards: Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum SOL G1; Sonneggstr.33 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1086 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._