a fix for use of posix isnan() function

This commit is contained in:
Jeff Hill
2001-07-31 21:35:26 +00:00
parent 11ffedc376
commit ba6a096e86
6 changed files with 31 additions and 11 deletions

View File

@@ -134,6 +134,7 @@ INC += epicsMutex.h
INC += osdMutex.h
INC += epicsEvent.h
INC += osdEvent.h
INC += epicsMath.h
INC += epicsAssert.h
INC += epicsFindSymbol.h
@@ -205,7 +206,6 @@ SRCS_RTEMS += rtems_util.c
# For vxWorks a clock
INC_vxWorks += iocClock.h
SRCS_vxWorks += iocClock.c
SRCS_vxWorks += isnan.c
# Library to build:
# lib$(LIBRARY).a or ..dll/..exp/..lib

View File

@@ -66,6 +66,7 @@
#include "dbDefs.h"
#define epicsExportSharedSymbols
#include "epicsMath.h"
#include "cvtFast.h"
#include "sCalcPostfix.h"
#include "sCalcPostfixPvt.h"
@@ -141,7 +142,7 @@ static void to_string(struct stackElement *ps)
{
ps->s = calloc(20, 1);
/* any precision greater than 8 results in (slow) sprintf call */
if (isnan(ps->d))
if (epicsIsNAN(ps->d))
strcpy(ps->s,"NaN");
else
(void)cvtDoubleToString(ps->d, ps->s, 8);
@@ -636,7 +637,7 @@ printf(") \n");
#endif
*presult = *pd;
if (psresult && (lenSresult > 15)) {
if (isnan(*pd))
if (epicsIsNAN(*pd))
strcpy(psresult,"NaN");
else
(void)cvtDoubleToString(*pd, psresult, 8);

View File

@@ -0,0 +1,9 @@
#ifndef epicsMathh
#define epicsMathh
#include "float.h"
#define epicsIsNAN(D) _isnan(D)
#endif /* epicsMathh */

View File

@@ -0,0 +1,9 @@
#ifndef epicsMathh
#define epicsMathh
#include "math.h"
#define epicsIsNAN(D) isnan(D)
#endif /* epicsMathh

View File

@@ -0,0 +1,9 @@
#ifndef epicsMathh
#define epicsMathh
#include <private/mathP.h>
#define epicsIsNAN(D) isNan(D)
#endif /* epicsMathh */

View File

@@ -1,8 +0,0 @@
int isnan(double d)
{
union { long l[2]; double d; } u;
u.d = d;
if ((u.l[0] & 0x7ff00000) != 0x7ff00000) return(0);
if (u.l[1] || (u.l[0] & 0x000fffff)) return(1);
return(0);
}