int nemoinpd (expr,doutv,nout) int nemoinpf (expr,foutv,nout) int nemoinpr (expr,routv,nout) int nemoinpi (expr,ioutv,nout) int nemoinpl (expr,loutv,nout) int nemoinpb (expr,boutv,nout) int nemoinpx (expr,doutv,nout) int nemorinpi (string var, int *xvar, int n, int defvar, bool repeated) int nemorinpd (string var, double *xvar, int n, double defvar, bool repeated) int nemorinpf (string var, float *xvar, int n, float defvar, bool repeated) int nemorinpl (string var, long *xvar, int n, long defvar, bool repeated) int nemorinpb (string var, int *xvar, int n, bool defvar, bool repeated) double natof(expr) int natoi(expr) char *expr; double doutv[]; float foutv[]; real routv[]; int ioutv[]; long loutv[]; bool boutv[]; int nout;
For convenience, NEMO parsing versions of the standard C library atof(3) and atoi(3) are provided as natof() and natoi(), but they do not provide any error checking (most importantly if the string contains non-number parts, except for the string "NaN" or "nan" in natof() where it will return the appropriate IEEE nan value).
An expression can have basic mathematical functions, such as addition, most transcendental functions and even some mathematical and physical constants. See also herinp(3NEMO) .
The only exception to herinp(3NEMO) parsing is nemoinpx, which parses a string in d:m:s.s format, returning the number(s) in fractional degrees. For h:m:s conversion, the user is responsible for the extra factor of 15 between d:m:s and h:m:s.
The nemorinpX routines were added to allow for filling exactly n values with defval (repeated=FALSE) or with the last used value (repeated=TRUE)
+ addition - subtraction * multiplication / division ** power
pi 3.14159.... c speed of light (SI) h Planck (SI) k Boltzmann (SI) g gravitation (SI) s Stefan-Boltzman (SI) m mass of sun (SI) p parsec (SI) undef errorval Note: the Hubble constant is not included.
abs(x) absolute value of x sqrt(x) square root of x sin(x) sine of x asin(x) inverse sine of x cos(x) cosine of x acos(x) inverse cosine of x tan(x) tangent of x atan(x) inverse tan of x exp(x) exponential of x sinh(x) hyperbolic sine of x ln(x) natural log of x cosh(x) hyperbolic cosine of x log(x) log (bas 10) of x tanh(x) hyperbolic tangent of x rad(x) convert x to radians deg(x) convert x to degrees erf(x) error function of x erfc(x) 1-error function max(x,y) maximum of x and y min(x,y) minimum of x and y sinc(x) sin(x)/x atan2(x,y) inverse tan (mod 2pi); x = sin, y = cos sign(x) sign of x (-1,0,1) mod(x,y) gives remainder of x/y int(x) truncates to integer nint(x) nearest integer ranu(x,y) generates uniform noise between x and y rang(x,y) generates gaussian noise with mean x and dispersion y ranp(x) generates poisson noise with mean x ifeq(x,y,a,b) returns a if x equal y, else b ifne(x,y,a,b) returns a if x not equal y, else b ifgt(x,y,a,b) returns a if x greater y, else b ifge(x,y,a,b) returns a if x greater or equal y, else b iflt(x,y,a,b) returns a if x less y, else b ifle(x,y,a,b) returns a if x less or equal y, else b
0 no error -11 bad call -12 unknown function -13 syntax error -14 illegal character -15 wrong repeat argument (maximum is 32767) -16 wrong number of arguments -17 arithmetic error -18 not enough internal memory -19 conversion error -20 unequal list length -21 empty list -22 nested lists -23 output buffer overflow -24 floating overflow/underflow in conversion
Loops, repeats and lists cannot be nested!!
1 2 3/3 sin(pi) yields 1.0 2.0 1.0 0.0 log(10)::4 yields 1.0 1.0 1.0 1.0 log(10):log(100):2/4 yields 1.0 1.5 2.0 10**[0 1 2 3] yields 1.0 10.0 100.0 1000.0
18-May-88 Implemented in NEMO by calling GIPSY’s herinp PJT xx-feb-89 nemoinp made archaic - must now call nemoinpX PJT 20-jun-89 doc updated PJT 4-mar-94 added nemoinpf/r PJT 31-may-01 added natof/natoi PJT 4-mar-03 1.9 added nemoinpx() PJT 28-jan-04 recognize nan’s in natof PJT jan-2005 added nemorinpX PJT