Displaying 2 results from an estimated 2 matches for "dbl_max_10_exp".
2002 Jan 16
0
round() doesn't (PR#1139)
...1200)
all.equal(round(100000/3, -2) - 33300, 0)
all.equal(round(1e15, -2) - 1e15, 0) # Fails in R-patched
Thanks to all for a great program, and congratulations on the release of 1.4.0!
---- begin C code for fround.c: ----
double fround(double x, double digits) {
#define MAX_DIGITS DBL_MAX_10_EXP
/* = 308 (IEEE); was till R 0.99: (DBL_DIG - 1) */
/* Note that large digits make sense for very small numbers */
double pow10, sgn, intx;
int dig;
#ifdef IEEE_754
if (ISNAN(x) || ISNAN(digits))
return x + digits;
if(!R_FINITE(x)) return x;
#endif
if (digits > MAX_...
2001 Oct 22
1
round() doesn't (PR#1139)
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". This is in 1.3.1 on Solaris 2.6 (full description at bottom).
[Apologies for making everyone read this 3 times; my bug.report() burped.]
Peter Dalgaard <p.dalgaard@biostat.ku.dk> says the problem is in fround.c,
which reads in part: