Experimental Physics and
| |||||||||||||||
|
Let me first give a brief discussion of NAN and INF. The IEEE floating point standard defines the concept of NAN (not a number) and INF (infinity). For each the exponent portion of the number has a unique bit pattern (normally all 1s), A NAN has a nonzero significand and an INF has a zero significand. A NAN is generated for invalid operations like 0/0. An INF is generated for exponent overflow. Part of the solution to the NAN problem Timo discovered was to make the following change to calcPerform diff -r1.31.6.1 calcPerform.c 104a105,106 > #include <private/mathP.h> /* For isNan*/ > #define isnan isNan 517c519 < return(0); --- > return((isnan(*presult) ? -1 : 0)); Thus a error is returned in calcPerform calculates a NAN. It looks like a solution for both NAN and INF is to change the return to return(((isnan(*presult)||isinf(*presult)) ? -1 : 0)); PROBLEM: This assumes that isnan and isinf are provided on all platforms that epics supports. Both isnan and isinf are defined as part of the ISO C standard from 1999. They are supported on redhat 7.2 linux. They are not supported on vxWorks 5.4 or on solaris 8. Not suprising considering the 1999 date. The following are diffs that allow me to compile 3.13 calcPerform on solaris, vxWorks, and linux redhat 7.2 > #include <stddef.h> 119a115,128 > #ifdef vxWorks > #include <vxWorks.h> > #include <private/mathP.h> /* For isNan*/ > #define isnan isNan > #define isinf isInf > #endif > > #ifdef SOLARIS > #define __EXTENSIONS__ > #include <limits.h> > #define isinf(D) \ > ((fabs((D))>DBL_MAX || fabs((D))<DBL_MIN) ? 1 : 0) > #endif > 519c528 < return(0); --- > return(((isnan(*presult)||isinf(*presult)) ? -1 : 0)); This is REALLY ugly. Worse what about HPUX, WINxx, and earlier releases of Solaris and Linux? What to do?????? Marty Kraimer
| ||||||||||||||
ANJ, 10 Aug 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |