From 2640c5fa073adf958c855ed64446f3c3584c0508 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 2 Apr 2009 21:15:26 +0000 Subject: [PATCH] Added epicsNAN and epicsINF to libCom/osi --- documentation/RELEASE_NOTES.html | 5 +++++ src/libCom/Makefile | 1 + src/libCom/osi/os/Darwin/epicsMath.h | 5 +++++ src/libCom/osi/os/RTEMS/epicsMath.h | 5 +++++ src/libCom/osi/os/VMS/epicsMath.h | 6 ++++++ src/libCom/osi/os/WIN32/epicsMath.h | 4 ++++ src/libCom/osi/os/hpux/epicsMath.h | 4 ++++ src/libCom/osi/os/osf/epicsMath.h | 6 ++++++ src/libCom/osi/os/posix/epicsMath.h | 5 +++++ src/libCom/osi/os/solaris/epicsMath.h | 6 +++++- src/libCom/osi/os/vxWorks/epicsMath.h | 4 ++++ src/libCom/test/epicsMathTest.c | 8 ++------ 12 files changed, 52 insertions(+), 7 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index b341d7e98..32314d431 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -12,6 +12,11 @@

Changes between 3.14.10 and 3.14.11

+

New math constants epicsNAN and epicsINF

+ +

Two new math constants have been added to epicsMath.h: epicsNAN +(not a number) and epicsINF (infinity). +

New event type DBE_PROPERTY

A new event type (flag in the Channel Access event mask) has been added diff --git a/src/libCom/Makefile b/src/libCom/Makefile index a7c1f3ccb..3d251f35c 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -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 diff --git a/src/libCom/osi/os/Darwin/epicsMath.h b/src/libCom/osi/os/Darwin/epicsMath.h index 4c580e68b..6dd2b87e1 100644 --- a/src/libCom/osi/os/Darwin/epicsMath.h +++ b/src/libCom/osi/os/Darwin/epicsMath.h @@ -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 +#include #define finite(x) isfinite(x) +epicsShareExtern float epicsNAN; +epicsShareExtern float epicsINF; + #endif /* epicsMathh */ diff --git a/src/libCom/osi/os/RTEMS/epicsMath.h b/src/libCom/osi/os/RTEMS/epicsMath.h index be7005b6b..aeb5132be 100644 --- a/src/libCom/osi/os/RTEMS/epicsMath.h +++ b/src/libCom/osi/os/RTEMS/epicsMath.h @@ -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 #include +#include + +epicsShareExtern float epicsNAN; +epicsShareExtern float epicsINF; #endif /* epicsMathh */ diff --git a/src/libCom/osi/os/VMS/epicsMath.h b/src/libCom/osi/os/VMS/epicsMath.h index 40b7d2a83..df8fba67b 100644 --- a/src/libCom/osi/os/VMS/epicsMath.h +++ b/src/libCom/osi/os/VMS/epicsMath.h @@ -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 +#include + #define isinf(D) (!finite((D)) && !(isnan((D)))) +epicsShareExtern float epicsNAN; +epicsShareExtern float epicsINF; + #endif /* epicsMathh */ diff --git a/src/libCom/osi/os/WIN32/epicsMath.h b/src/libCom/osi/os/WIN32/epicsMath.h index 99580be03..f9da1502b 100644 --- a/src/libCom/osi/os/WIN32/epicsMath.h +++ b/src/libCom/osi/os/WIN32/epicsMath.h @@ -13,6 +13,7 @@ #include #include +#include #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 */ diff --git a/src/libCom/osi/os/hpux/epicsMath.h b/src/libCom/osi/os/hpux/epicsMath.h index 7e6b2f46f..f1a8cb7c4 100644 --- a/src/libCom/osi/os/hpux/epicsMath.h +++ b/src/libCom/osi/os/hpux/epicsMath.h @@ -12,7 +12,11 @@ #define epicsMathh #include +#include #define finite(D) (isfinite(D) != 0) +epicsShareExtern float epicsNAN; +epicsShareExtern float epicsINF; + #endif /* epicsMathh */ diff --git a/src/libCom/osi/os/osf/epicsMath.h b/src/libCom/osi/os/osf/epicsMath.h index 40b7d2a83..df8fba67b 100644 --- a/src/libCom/osi/os/osf/epicsMath.h +++ b/src/libCom/osi/os/osf/epicsMath.h @@ -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 +#include + #define isinf(D) (!finite((D)) && !(isnan((D)))) +epicsShareExtern float epicsNAN; +epicsShareExtern float epicsINF; + #endif /* epicsMathh */ diff --git a/src/libCom/osi/os/posix/epicsMath.h b/src/libCom/osi/os/posix/epicsMath.h index 848b375ee..095062f9c 100644 --- a/src/libCom/osi/os/posix/epicsMath.h +++ b/src/libCom/osi/os/posix/epicsMath.h @@ -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 +#include + +epicsShareExtern float epicsNAN; +epicsShareExtern float epicsINF; #endif /* epicsMathh */ diff --git a/src/libCom/osi/os/solaris/epicsMath.h b/src/libCom/osi/os/solaris/epicsMath.h index 0f714acde..41176401e 100644 --- a/src/libCom/osi/os/solaris/epicsMath.h +++ b/src/libCom/osi/os/solaris/epicsMath.h @@ -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 - #include +#include #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 */ diff --git a/src/libCom/osi/os/vxWorks/epicsMath.h b/src/libCom/osi/os/vxWorks/epicsMath.h index eddb756f8..acd607491 100644 --- a/src/libCom/osi/os/vxWorks/epicsMath.h +++ b/src/libCom/osi/os/vxWorks/epicsMath.h @@ -13,9 +13,13 @@ #include #include +#include #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 */ diff --git a/src/libCom/test/epicsMathTest.c b/src/libCom/test/epicsMathTest.c index ab7a633fd..4879bea01 100644 --- a/src/libCom/test/epicsMathTest.c +++ b/src/libCom/test/epicsMathTest.c @@ -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");