Experimental Physics and
| |||||||||||||||
|
Hello- to the keepers of the Sacred Source Code, in the course of developing some
displays I noticed that a PV which should never be < 0 had a persistent flickering minus
sign (-0.000)... the cause was traced to the implentation of ABS in the calc record, ie:
case ABS_VAL:
if (*ptop < 0.0) *ptop = - *ptop;
break;
In my case, the CALC is "ABS(A*B)", and e.g. A=0 and B<0 results in ABS(-0), which does
not satisfy the if() in the code because -0 is NOT less than zero, so the sign is not flipped
back to positive.
Using fabs() instead fixes it (and probably also saves a branch).
cheers,
Mike
-----
| ||||||||||||||
ANJ, 15 Jul 2016 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |