calc: add FMOD

This commit is contained in:
Michael Davidsaver
2022-03-28 11:37:57 -07:00
parent 9c0c486111
commit a6afef4850
7 changed files with 23 additions and 1 deletions
+4
View File
@@ -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)
+5
View File
@@ -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);
+1
View File
@@ -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},
+1
View File
@@ -71,6 +71,7 @@ typedef enum {
/* Numeric */
CEIL,
FLOOR,
FMOD,
FINITE,
ISINF,
ISNAN,
+6 -1
View File
@@ -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));