search for: ml_err_return_nan

Displaying 19 results from an estimated 19 matches for "ml_err_return_nan".

2005 Apr 02
2
Solaris10/amd64 + SunSutio Compile (PR#7767)
...e: op "isfinite" cc: acomp failed for rbinom.c Following patch may solve this problem. *** R-2.0.1.orig/src/nmath/rbinom.c Mon Nov 15 21:33:01 2004 --- R-2.0.1/src/nmath/rbinom.c Sun Apr 3 00:19:52 2005 *************** *** 57,63 **** n = floor(nin + 0.5); if (n != nin) ML_ERR_return_NAN; ! if (!R_FINITE(n) || !R_FINITE(pp) || /* n=0, p=0, p=1 are not errors <TSL>*/ n < 0 || pp < 0. || pp > 1.) ML_ERR_return_NAN; --- 57,63 ---- n = floor(nin + 0.5); if (n != nin) ML_ERR_return_NAN; ! if (!R_FINITE((double)n) || !R_FINITE(pp)...
2019 Dec 08
2
What should dnorm(0, 0, -Inf) return?
Yes, that looks like a bug and an easily fixable one too. However, I spy another issue: Why do we check the !R_FINITE(x) && mu == x before checking for sd < 0 ? The difference is whether we return ML_NAN; or ML_ERR_return_NAN; but surely negative sd should always be an error? I'd be inclined to do if (sigma < 0) ML_ERR_return_NAN; if(!R_FINITE(sigma)) return R_D__0; if(!R_FINITE(x) && mu == x) return ML_NAN;/* x-mu is NaN */ if (sigma == 0) return (x == mu) ? ML_POSINF : R_D__0...
2019 Dec 07
2
What should dnorm(0, 0, -Inf) return?
Hi, Apropos of a recent Inf question, I've previously wondered if dnorm "does the right thing" with dnorm(0, 0, -Inf) which gives zero. Should that be zero or NaN (or NA)? The help says "'sd < 0' is an error and returns 'NaN'" and since -Inf < 0 is TRUE, then... is this a bug? Thank you, Stephen Rochester, MN USA
2000 Feb 25
1
lambda==0 in dpois() (PR#459)
...patch to src/nmath/dpois.c that appears to work (although it could ? be more elegant). *** dpois.c.orig Fri Feb 25 13:53:06 2000 --- dpois.c Fri Feb 25 14:16:19 2000 *************** *** 35,41 **** warning("non-integer x = %f", x); return R_D__0; } ! if(lambda <= 0.0) ML_ERR_return_NAN; if (x < 0) return R_D__0; --- 35,51 ---- warning("non-integer x = %f", x); return R_D__0; } ! if(lambda < 0.0) ML_ERR_return_NAN; ! if(lambda==0.0) { ! if (give_log) { ! if (x==0) return 0.0; ! else ML_ERR_return_NAN; !...
2019 Dec 09
0
What should dnorm(0, 0, -Inf) return?
...12:11:50 +0100 writes: > Yes, that looks like a bug and an easily fixable one too. agreed. > However, I spy another issue: Why do we check the > !R_FINITE(x) && mu == x before checking for sd < 0 ? The > difference is whether we > return ML_NAN; or ML_ERR_return_NAN; > but surely negative sd should always be an error? > I'd be inclined to do > if (sigma < 0) ML_ERR_return_NAN; > if(!R_FINITE(sigma)) return R_D__0; > if(!R_FINITE(x) && mu == x) return ML_NAN;/* x-mu is NaN */ > if (sigma == 0) &gt...
2016 Dec 01
2
Different results for cos,sin,tan and cospi,sinpi,tanpi
...ether the following becomes all right. diff -ruN R-3.3.2.orig/src/nmath/cospi.c R-3.3.2/src/nmath/cospi.c --- R-3.3.2.orig/src/nmath/cospi.c 2016-09-15 07:15:31.000000000 +0900 +++ R-3.3.2/src/nmath/cospi.c 2016-12-01 13:54:38.863357149 +0900 @@ -35,7 +35,11 @@ #endif if(!R_FINITE(x)) ML_ERR_return_NAN; - x = fmod(fabs(x), 2.);// cos() symmetric; cos(pi(x + 2k)) == cos(pi x) for all integer k + x = fabs(x); + if ( x > 9007199254740991 ) /* 2^53-1 */ + return cos(M_PI * x); + + x = fmod(x, 2.);// cos() symmetric; cos(pi(x + 2k)) == cos(pi x) for all integer k if(fmod(x,...
2000 Jun 16
2
R and OpenBSD
Howdy! Has anybody successfully installed R under OpenBSD? I just tried to install the latest R-release under OpenBSD 2.7 and got the following errors in the make step: pnorm.c:62 'ML_ERR_return_NAN' undeclared pnorm.c:62 'ML_NAN' undeclared pnorm.c:62 'ML_NEGINF' undeclared --Ragnar -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help&qu...
2000 Jun 16
2
R and OpenBSD
Howdy! Has anybody successfully installed R under OpenBSD? I just tried to install the latest R-release under OpenBSD 2.7 and got the following errors in the make step: pnorm.c:62 'ML_ERR_return_NAN' undeclared pnorm.c:62 'ML_NAN' undeclared pnorm.c:62 'ML_NEGINF' undeclared --Ragnar -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help&qu...
2005 May 27
1
qcauchy accuracy (PR#7902)
...d finite directly. It needs to be adapted to the R way of doing that. double qcauchy (double p, double location, double scale, int lower_tail, int log_p) { if (isnan(p) || isnan(location) || isnan(scale)) return p + location + scale; R_Q_P01_check(p); if (scale < 0 || !finite(scale)) ML_ERR_return_NAN; if (log_p) { if (p > -1) lower_tail = !lower_tail, p = -expm1 (p); else p = exp (p); } if (lower_tail) scale = -scale; return location + scale / tan(M_PI * p); }
2005 Aug 09
0
qpois minor bug (PR#8058)
...ramowitz and Stegun 'Handbook of Mathmatical Functions' pages 935 and 928 Mikael double qpois(double p, double lambda, int lower_tail, int log_p) { double mu, sigma, gamma, z, y; #ifdef IEEE_754 if (ISNAN(p) || ISNAN(lambda)) return p + lambda; #endif if(!R_FINITE(lambda)) ML_ERR_return_NAN; R_Q_P01_boundaries(p, 0, ML_POSINF); if(lambda < 0) ML_ERR_return_NAN; if(lambda == 0) return 0; mu = lambda; sigma = sqrt(lambda); gamma = sigma; /* Note : "same" code in qpois.c, qbinom.c, qnbinom.c -- * FIXME: This is far from optimal [cancellat...
2005 Dec 28
1
NaN in R distribution functions
...r R developers, I noticed that core R distribution functions return NaN, when parameter values are out of parameter space. I have looked in source code and found that warnings and return of NaN are done internally in C code. For dgamma.c the line 49 is: if (shape <= 0 || scale <= 0) ML_ERR_return_NAN; OK. How should this be implemented if distribution functions are written directly in R? I came up with this if (any(shape <= 0)) { warning("shape must be positive") return(NaN) } I think that it would be nice that returning NaN for undefined parameter...
2016 Dec 01
1
Different results for cos,sin,tan and cospi,sinpi,tanpi
hi, my environment... > sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 8 (jessie) locale: [1] LC_CTYPE=ja_JP.UTF-8 LC_NUMERIC=C [3] LC_TIME=ja_JP.UTF-8 LC_COLLATE=ja_JP.UTF-8 [5] LC_MONETARY=ja_JP.UTF-8 LC_MESSAGES=ja_JP.UTF-8 [7] LC_PAPER=ja_JP.UTF-8 LC_NAME=C [9] LC_ADDRESS=C
2019 Dec 07
0
What should dnorm(0, 0, -Inf) return?
...ble x, double mu, double sigma, int give_log) { #ifdef IEEE_754 if (ISNAN(x) || ISNAN(mu) || ISNAN(sigma)) return x + mu + sigma; #endif if(!R_FINITE(sigma)) return R_D__0; if(!R_FINITE(x) && mu == x) return ML_NAN;/* x-mu is NaN */ if (sigma <= 0) { if (sigma < 0) ML_ERR_return_NAN; /* sigma == 0 */ return (x == mu) ? ML_POSINF : R_D__0; } .... } ``` You can clearly see where the problem is. I think either the document or the code needs a modification. Best, Jiefei On Sat, Dec 7, 2019 at 5:05 PM Weigand, Stephen D. via R-devel < r-devel at r-proj...
2004 Apr 15
0
phyper accuracy and efficiency (PR#6772)
...(isnangnum (i) || isnangnum (NR) || isnangnum (NB) || isnangnum (n)) return i + NR + NB + n; #endif i = floorgnum (i + 1e-7); NR = floorgnum (NR + 0.5); NB = floorgnum (NB + 0.5); n = floorgnum (n + 0.5); if (NR < 0 || NB < 0 || !finitegnum (NR + NB) || n < 0 || n > NR + NB) ML_ERR_return_NAN; if (i * (NR + NB) > n * NR) { /* Swap tails. */ gnm_float oldNB = NB; NB = NR; NR = oldNB; i = n - i - 1; lower_tail = !lower_tail; } if (i < 0) return R_DT_0; d = dhyper (i, NR, NB, n, log_p); pd = pdhyper (i, NR, NB, n, log_p); return log_p ? R_DT_log (d + pd) : R_...
2000 Aug 26
0
Re: [R] too large alpha or beta in dbeta ? (PR#643)
...ed correctly */ if (ISNAN(x) || ISNAN(a) || ISNAN(b)) return x + a + b; + +# define xmax 171.61447887182298/* (fixme) -->> ./gammalims.c */ + +#else + static double xmax = 0; double xmin; + if (xmax == 0) + gammalims(&xmin, &xmax); #endif + if (a <= 0 || b <= 0) ML_ERR_return_NAN; if (x < 0 || x > 1) @@ -35,10 +43,13 @@ if (x < 0 || x > 1) return R_D__0; + +#define R_LOG_DBETA log(x)*(a - 1) + log(1 - x)*(b - 1) - lbeta(a, b) - if(give_log) { - return log(x)*(a - 1) + log(1 - x)*(b - 1) - lbeta(a, b); - } + if(give_log) + return R_LOG_...
2000 Aug 28
0
Re: [R] too large alpha or beta in dbeta ? (PR#643)
...ed correctly */ if (ISNAN(x) || ISNAN(a) || ISNAN(b)) return x + a + b; + +# define xmax 171.61447887182298/* (fixme) -->> ./gammalims.c */ + +#else + static double xmax = 0; double xmin; + if (xmax == 0) + gammalims(&xmin, &xmax); #endif + if (a <= 0 || b <= 0) ML_ERR_return_NAN; if (x < 0 || x > 1) @@ -35,10 +43,13 @@ if (x < 0 || x > 1) return R_D__0; + +#define R_LOG_DBETA log(x)*(a - 1) + log(1 - x)*(b - 1) - lbeta(a, b) - if(give_log) { - return log(x)*(a - 1) + log(1 - x)*(b - 1) - lbeta(a, b); - } + if(give_log) + return R_LOG_...
2003 Jul 16
2
Density function for non-central t distribution
...log-scale to increase stability. * */ #include "nmath.h" #include "dpq.h" double dnt(double x, double df, double ncp, int give_log) { double u; #ifdef IEEE_754 if (ISNAN(x) || ISNAN(df)) return x + df; #endif // If non-positive df then error if (df <= 0) ML_ERR_return_NAN; // If x is infinite then return 0 if(!R_FINITE(x)) return R_D__0; // If infinite df then the density is identical to a // normal distribution with mean = ncp if(!R_FINITE(df)) return dnorm(x, ncp, 1., give_log); // Consider two cases: x==0 or not // Do calcul...
2004 Oct 22
3
pgamma discontinuity (PR#7307)
Full_Name: Morten Welinder Version: 2 OS: Solaris/space/gcc2.95.2 Submission from: (NULL) (65.213.85.217) I changed src/nmath/standalone/test.c to read: --------------------------------------------------------------------------------- #define MATHLIB_STANDALONE 1 #include <Rmath.h> #include <stdio.h> int main() { double x; for (x = 99990; x <= 100009; x++) printf
2016 Jul 01
1
Calling C implementations of rnorm and friends
Well, For this particular use case why not just transform the parameters at the R level and then call the existing function? Is there not a closed form mapping? ~G On Jul 1, 2016 2:50 PM, "Joshua Ulrich" <josh.m.ulrich at gmail.com> wrote: > On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier > <luis.henrique.usier at gmail.com> wrote: > > Gabriel, > > > >