diff options
| author | Richard M. Stallman | 1993-01-13 00:25:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-01-13 00:25:03 +0000 |
| commit | 0601fd3d8f9dab900b9fdd7d840837a24530c138 (patch) | |
| tree | 075159da9acdc60da88c721049fb2559b6644fa5 /src | |
| parent | c24e9a53b3dc22babf9fc4a47bd37a8c7689d6f5 (diff) | |
| download | emacs-0601fd3d8f9dab900b9fdd7d840837a24530c138.tar.gz emacs-0601fd3d8f9dab900b9fdd7d840837a24530c138.zip | |
(float_to_string): Add final 0 if text ends with decimal pt.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/print.c b/src/print.c index 0b6139a5c78..e9bfbcf2fcb 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -640,12 +640,18 @@ float_to_string (buf, data) | |||
| 640 | sprintf (buf, XSTRING (Vfloat_output_format)->data, data); | 640 | sprintf (buf, XSTRING (Vfloat_output_format)->data, data); |
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | /* Make sure there is a decimal point or an exponent, | 643 | /* Make sure there is a decimal point with digit after, or an exponent, |
| 644 | so that the value is readable as a float. */ | 644 | so that the value is readable as a float. */ |
| 645 | for (cp = buf; *cp; cp++) | 645 | for (cp = buf; *cp; cp++) |
| 646 | if (*cp < '0' || *cp > '9') | 646 | if (*cp < '0' || *cp > '9') |
| 647 | break; | 647 | break; |
| 648 | 648 | ||
| 649 | if (*cp == '.' && cp[1] == 0) | ||
| 650 | { | ||
| 651 | cp[1] = '0'; | ||
| 652 | cp[2] = 0; | ||
| 653 | } | ||
| 654 | |||
| 649 | if (*cp == 0) | 655 | if (*cp == 0) |
| 650 | { | 656 | { |
| 651 | *cp++ = '.'; | 657 | *cp++ = '.'; |