fcn sgn()

This commit is contained in:
h_vogt 2010-03-07 15:59:08 +00:00
parent b89648441b
commit 9bdf85c43c
3 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2010-03-14 Holger Vogt
* inpcom.c: test for .end improved (comments are now allowed in .end line)
* xpressn.c: adding fcn sgn() to numparam function lib
2010-03-07 Dietmar Warning
* analysis/ninteg.c: limiting exp() in noise integration to prevent overflow and NAN
(ID: 2950943).

View File

@ -1324,9 +1324,12 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name)
*(s-1) = '\0';
}
if (ciprefix(".end", buffer) && strlen(buffer) == 4 ) {
found_end = TRUE;
*buffer = '*';
/* find the true .end command out of .endc, .ends, .endl, .end (comments may follow) */
if (ciprefix(".end", buffer)) {
if ((*(buffer+4) == '\0') || ( isspace(*(buffer+4)))) {
found_end = TRUE;
*buffer = '*';
}
}
/* removed because code changes .global to *global before it will be

View File

@ -61,7 +61,7 @@ initkeys (void)
"and or not div mod if else end while macro funct defined"
" include for to downto is var");
scopy_up (&fmathS,
"sqr sqrt sin cos exp ln arctan abs pow pwr max min int log sinh cosh tanh ternary_fcn v agauss");
"sqr sqrt sin cos exp ln arctan abs pow pwr max min int log sinh cosh tanh ternary_fcn v agauss sgn");
}
static double
@ -121,6 +121,11 @@ mathfunction (int f, double z, double x)
case 17:
y=sinh(x)/cosh(x);
break;
case 21:
if (x>0) y=1.;
else if (x == 0) y=0.;
else y = -1.;
break;
default:
y = x;
break;