diff --git a/src/libCom/cvtFast/cvtFast.c b/src/libCom/cvtFast/cvtFast.c index 65e4d5dec..9672499f0 100644 --- a/src/libCom/cvtFast/cvtFast.c +++ b/src/libCom/cvtFast/cvtFast.c @@ -30,6 +30,7 @@ #define epicsExportSharedSymbols #include "cvtFast.h" +#include "epicsMath.h" /* * This routine converts numbers less than 10,000,000. It defers to f_to_str for @@ -49,7 +50,7 @@ int epicsShareAPI cvtFloatToString( char *startAddr; /* can this routine handle this conversion */ - if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { + if (isnan(flt_value) || precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { sprintf(pstr_value,"%12.5e",(double)flt_value); return((int)strlen(pstr_value)); } @@ -123,7 +124,7 @@ int epicsShareAPI cvtDoubleToString( char *startAddr; /* can this routine handle this conversion */ - if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { + if (isnan(flt_value) || precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) { if(precision>17) precision=17; sprintf(pstr_value,"%*.*e",precision+7,precision,