Added epicsNAN and epicsINF to libCom/osi

This commit is contained in:
Ralph Lange
2009-04-02 21:15:26 +00:00
parent e18eb714a8
commit 2640c5fa07
12 changed files with 52 additions and 7 deletions

View File

@@ -12,6 +12,11 @@
<h2 align="center">Changes between 3.14.10 and 3.14.11</h2>
<!-- Insert new items below here ... -->
<h4>New math constants epicsNAN and epicsINF</h4>
<p>Two new math constants have been added to epicsMath.h: <tt>epicsNAN</tt>
(not a number) and <tt>epicsINF</tt> (infinity).
<h4>New event type DBE_PROPERTY</h4>
<p>A new event type (flag in the Channel Access event mask) has been added

View File

@@ -199,6 +199,7 @@ SRCS += epicsMutex.cpp
SRCS += epicsEvent.cpp
SRCS += epicsTime.cpp
SRCS += epicsMessageQueue.cpp
SRCS += epicsMath.cpp
SRCS += epicsGeneralTime.c
SRCS += osiClockTime.c

View File

@@ -7,11 +7,16 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsMathh
#define epicsMathh
#include <math.h>
#include <shareLib.h>
#define finite(x) isfinite(x)
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -7,10 +7,15 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsMathh
#define epicsMathh
#include <math.h>
#include <ieeefp.h>
#include <shareLib.h>
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -7,10 +7,16 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsMathh
#define epicsMathh
#include <math.h>
#include <shareLib.h>
#define isinf(D) (!finite((D)) && !(isnan((D))))
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -13,6 +13,7 @@
#include <math.h>
#include <float.h>
#include <shareLib.h>
#ifndef finite
#define finite(D) _finite(D)
@@ -26,4 +27,7 @@
#define isinf(D) ( !_finite(D) && !_isnan(D) )
#endif
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -12,7 +12,11 @@
#define epicsMathh
#include <math.h>
#include <shareLib.h>
#define finite(D) (isfinite(D) != 0)
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -7,10 +7,16 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsMathh
#define epicsMathh
#include <math.h>
#include <shareLib.h>
#define isinf(D) (!finite((D)) && !(isnan((D))))
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -7,9 +7,14 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsMathh
#define epicsMathh
#include <math.h>
#include <shareLib.h>
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -4,16 +4,20 @@
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef INC_epicsMath_H
#define INC_epicsMath_H
#include <math.h>
#include <ieeefp.h>
#include <shareLib.h>
#ifndef isinf
# define isinf(x) (((x)==(x)) && !finite((x)))
/* same as (!isnan(x) && !finite(x)) */
#endif
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* INC_epicsMath_H */

View File

@@ -13,9 +13,13 @@
#include <math.h>
#include <private/mathP.h>
#include <shareLib.h>
#define isnan(D) isNan(D)
#define isinf(D) isInf(D)
#define finite(D) (!isNan(D) && !isInf(D))
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#endif /* epicsMathh */

View File

@@ -28,9 +28,7 @@ MAIN(epicsMathTest)
testOk(!isinf(c), "!isinf(0.0 / 1.0)");
testOk(c == 0.0, "0.0 / 1.0 == 0.0");
a = 1.0;
b = 0.0;
c = a / b;
c = epicsINF;
testOk(!isnan(c), "!isnan(1.0 / 0.0)");
testOk(isinf(c), "isinf(1.0 / 0.0)");
testOk(c == c, "1.0 / 0.0 == 1.0 / 0.0");
@@ -38,9 +36,7 @@ MAIN(epicsMathTest)
testOk(c + -c != b, "inf + -inf != 0");
testOk(-c + c != b, "-inf + inf != 0");
a = 0.0;
b = 0.0;
c = a / b;
c = epicsNAN;
testOk(isnan(c), "isnan(0.0 / 0.0)");
testOk(!isinf(c), "!isinf(0.0 / 0.0)");
testOk(c != c, "0.0 / 0.0 != 0.0 / 0.0");