Mercurial > octave
diff liboctave/numeric/randpoisson.cc @ 21721:bcc30b45a225
define octave_numeric_limits template methods for Inf and NaN
* lo-ieee.h (octave_numeric_limits::Inf, octave_numeric_limits::NaN):
New methods.
* Canvas.cc, data.cc, graphics.cc, graphics.in.h, oct-handle.h,
oct-stream.cc, quadcc.cc, sparse-xdiv.cc, str2double.cc, variables.h,
__glpk__.cc, __init_fltk__.cc, __voronoi__.cc, octave.cc, Matrix.cc,
CNDArray.cc, CSparse.cc, Sparse-C.cc, dDiagMatrix.cc, dMatrix.cc,
dSparse.cc, fCMatrix.cc, fCNDArray.cc, fDiagMatrix.cc, fMatrix.cc,
Faddeeva.cc, eigs-base.cc, lo-mappers.cc, lo-mappers.h, lo-specfun.cc,
oct-norm.cc, oct-rand.cc, oct-rand.h, oct-spparms.cc, randgamma.cc,
randpoisson.cc: Use them instead of octave_Inf, octave_Float_Inf,
octave_NaN, and octave_Float_NaN.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 17 May 2016 01:11:27 -0400 |
parents | b28c26ae737c |
children | bae585228161 |
line wrap: on
line diff
--- a/liboctave/numeric/randpoisson.cc Mon May 16 23:20:50 2016 -0400 +++ b/liboctave/numeric/randpoisson.cc Tue May 17 01:11:27 2016 -0400 @@ -42,8 +42,6 @@ #include "randmtzig.h" #include "randpoisson.h" -#undef NAN -#define NAN octave_NaN #undef INFINITE #define INFINITE lo_ieee_isinf #define RUNI oct_randu() @@ -485,7 +483,7 @@ if (L < 0.0 || INFINITE(L)) { for (i=0; i<n; i++) - p[i] = NAN; + p[i] = octave_numeric_limits<double>::NaN (); } else if (L <= 10.0) { @@ -514,7 +512,7 @@ oct_randp (double L) { double ret; - if (L < 0.0) ret = NAN; + if (L < 0.0) ret = octave_numeric_limits<double>::NaN (); else if (L <= 12.0) { /* From Press, et al. Numerical recipes */ @@ -537,7 +535,7 @@ { /* FIXME: R uses NaN, but the normal approximation suggests that * limit should be Inf. Which is correct? */ - ret = NAN; + ret = octave_numeric_limits<double>::NaN (); } else { @@ -557,7 +555,7 @@ if (L < 0.0 || INFINITE(L)) { for (i=0; i<n; i++) - p[i] = NAN; + p[i] = octave_numeric_limits<double>::NaN (); } else if (L <= 10.0) { @@ -587,7 +585,7 @@ { double L = FL; float ret; - if (L < 0.0) ret = NAN; + if (L < 0.0) ret = octave_numeric_limits<float>::NaN (); else if (L <= 12.0) { /* From Press, et al. Numerical recipes */ @@ -610,7 +608,7 @@ { /* FIXME: R uses NaN, but the normal approximation suggests that * limit should be Inf. Which is correct? */ - ret = NAN; + ret = octave_numeric_limits<float>::NaN (); } else {