Omit unneeded decimal points in modp_dtoa2() scientific notation output

For example, "1e-13" is now used instead of "1.e-13".
This commit is contained in:
Jon Siwek 2021-05-17 17:56:19 -07:00
parent 48ee0f31a1
commit 8996dfbfef
2 changed files with 7 additions and 3 deletions

View file

@ -55,6 +55,7 @@ static void sn_strip_trailing_zeros(char* str)
if ( ! frac )
return;
char* start_dec = frac;
char* exp = 0;
char* trailing_zeros = 0;
@ -80,6 +81,9 @@ static void sn_strip_trailing_zeros(char* str)
++frac;
}
if ( trailing_zeros == start_dec )
--trailing_zeros;
if ( trailing_zeros && exp )
{
for ( ; ; )