allow for nan and inf

This commit is contained in:
Marty Kraimer
2002-04-11 15:49:24 +00:00
parent 4428be70c3
commit 412f5e32b4

View File

@@ -88,11 +88,16 @@ static void realToString(double value,char *preturn,int isdouble)
if(value<0.0) {*preturn++ = '-'; value = -value;}
logval = (int)log10(value);
if(logval>6 || logval<-2 ) {
int nout;
ise=TRUE;
prec = precision[isdouble];
sprintf(ptstr,"%.*e",prec,value);
nout = sprintf(ptstr,"%.*e",prec,value);
loce = strchr(ptstr,'e');
if(!loce) {errMessage(-1,"logic error in real to string"); return;}
if(!loce) {
ptstr[nout] = 0;
strcpy(preturn,ptstr);
return;
}
*loce++ = 0;
} else {
prec = precision[isdouble]-logval;