numparam, use `trunc()'
This commit is contained in:
parent
31ca73a6f0
commit
15e8fab975
|
|
@ -41,6 +41,5 @@ int yes_or_no(void);
|
||||||
int freadstr(FILE *f, SPICE_DSTRINGPTR dstr_p);
|
int freadstr(FILE *f, SPICE_DSTRINGPTR dstr_p);
|
||||||
|
|
||||||
double np_round(double d); // sjb to avoid clash with round() in math.h
|
double np_round(double d); // sjb to avoid clash with round() in math.h
|
||||||
double np_trunc(double x); // sjb to avoid clash with trunc() in math.h
|
|
||||||
double absf(double x); /* abs */
|
double absf(double x); /* abs */
|
||||||
long absi(long i);
|
long absi(long i);
|
||||||
|
|
|
||||||
|
|
@ -479,13 +479,3 @@ np_round(double r)
|
||||||
{
|
{
|
||||||
return floor(r + 0.5);
|
return floor(r + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double
|
|
||||||
np_trunc(double r)
|
|
||||||
{
|
|
||||||
if (r >= 0.0)
|
|
||||||
return floor(r);
|
|
||||||
else
|
|
||||||
return ceil(r);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -843,11 +843,11 @@ operate(char op, double x, double y)
|
||||||
x = z;
|
x = z;
|
||||||
break;
|
break;
|
||||||
case '%': /* % */
|
case '%': /* % */
|
||||||
t = np_trunc(x / y);
|
t = trunc(x / y);
|
||||||
x = x - y * t;
|
x = x - y * t;
|
||||||
break;
|
break;
|
||||||
case '\\': /* / */
|
case '\\': /* / */
|
||||||
x = np_trunc(fabs(x / y));
|
x = trunc(fabs(x / y));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue