calc: add FMOD
This commit is contained in:
@@ -17,6 +17,10 @@ should also be read to understand what has changed since earlier releases.
|
||||
|
||||
<!-- Insert new items immediately below here ... -->
|
||||
|
||||
### Add FMOD as CALC Expression
|
||||
|
||||
The floating point modulo function `FMOD(NUM,DEN)` is added.
|
||||
|
||||
## EPICS Release 7.0.7
|
||||
|
||||
### Doxygen Annotations
|
||||
|
||||
@@ -157,6 +157,9 @@ CEIL: Ceiling (unary)
|
||||
=item *
|
||||
FLOOR: Floor (unary)
|
||||
|
||||
=item *
|
||||
FMOD: Floating point modulo (binary) Added in UNRELEASED
|
||||
|
||||
=item *
|
||||
LOG: Log base 10 (unary)
|
||||
|
||||
|
||||
@@ -183,6 +183,9 @@ CEIL: Ceiling (unary)
|
||||
=item *
|
||||
FLOOR: Floor (unary)
|
||||
|
||||
=item *
|
||||
FMOD: Floating point modulo (binary) Added in UNRELEASED
|
||||
|
||||
=item *
|
||||
LOG: Log base 10 (unary)
|
||||
|
||||
|
||||
@@ -240,6 +240,11 @@ LIBCOM_API long
|
||||
*ptop = floor(*ptop);
|
||||
break;
|
||||
|
||||
case FMOD:
|
||||
top = *ptop--;
|
||||
*ptop = fmod(*ptop, top);
|
||||
break;
|
||||
|
||||
case FINITE:
|
||||
nargs = *pinst++;
|
||||
top = finite(*ptop);
|
||||
|
||||
@@ -104,6 +104,7 @@ static const ELEMENT operands[] = {
|
||||
{"F", 0, 0, 1, OPERAND, FETCH_F},
|
||||
{"FINITE", 7, 8, 0, VARARG_OPERATOR,FINITE},
|
||||
{"FLOOR", 7, 8, 0, UNARY_OPERATOR, FLOOR},
|
||||
{"FMOD", 7, 8, -1, UNARY_OPERATOR, FMOD},
|
||||
{"G", 0, 0, 1, OPERAND, FETCH_G},
|
||||
{"H", 0, 0, 1, OPERAND, FETCH_H},
|
||||
{"I", 0, 0, 1, OPERAND, FETCH_I},
|
||||
|
||||
@@ -71,6 +71,7 @@ typedef enum {
|
||||
/* Numeric */
|
||||
CEIL,
|
||||
FLOOR,
|
||||
FMOD,
|
||||
FINITE,
|
||||
ISINF,
|
||||
ISNAN,
|
||||
|
||||
@@ -298,7 +298,7 @@ MAIN(epicsCalcTest)
|
||||
const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0,
|
||||
g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0;
|
||||
|
||||
testPlan(630);
|
||||
testPlan(635);
|
||||
|
||||
/* LITERAL_OPERAND elements */
|
||||
testExpr(0);
|
||||
@@ -370,6 +370,11 @@ MAIN(epicsCalcTest)
|
||||
testExpr(cosh(0.5));
|
||||
testExpr(exp(1.));
|
||||
testExpr(floor(1.5));
|
||||
testExpr(fmod(1.5, 1.0));
|
||||
testExpr(fmod(-1.5, 1.0));
|
||||
testExpr(fmod(1.5, -1.0));
|
||||
testExpr(fmod(-1.5, -1.0));
|
||||
testExpr(fmod(1.5, 0.0));
|
||||
|
||||
testExpr(finite(0.));
|
||||
testExpr(finite(Inf));
|
||||
|
||||
Reference in New Issue
Block a user