From e62f7d0ae264225760764d402d74648cf466a503 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 11 Oct 1995 19:42:52 +0000 Subject: [PATCH] cvtDoubleToString: honor precision for wierd numbers --- src/libCom/cvtFast.c | 3 ++- src/libCom/cvtFast/cvtFast.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libCom/cvtFast.c b/src/libCom/cvtFast.c index dee0e93dc..9312031b3 100644 --- a/src/libCom/cvtFast.c +++ b/src/libCom/cvtFast.c @@ -151,7 +151,8 @@ int cvtDoubleToString( /* can this routine handle this conversion */ if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) { - sprintf(pstr_value,"%12.5e\0",flt_value); + sprintf(pstr_value,"%*.*e\0",precision+7,precision, + flt_value); } else { sprintf(pstr_value,"%.0f\0",flt_value); } diff --git a/src/libCom/cvtFast/cvtFast.c b/src/libCom/cvtFast/cvtFast.c index dee0e93dc..9312031b3 100644 --- a/src/libCom/cvtFast/cvtFast.c +++ b/src/libCom/cvtFast/cvtFast.c @@ -151,7 +151,8 @@ int cvtDoubleToString( /* can this routine handle this conversion */ if (precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) { - sprintf(pstr_value,"%12.5e\0",flt_value); + sprintf(pstr_value,"%*.*e\0",precision+7,precision, + flt_value); } else { sprintf(pstr_value,"%.0f\0",flt_value); }