aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-01-13 00:25:03 +0000
committerRichard M. Stallman1993-01-13 00:25:03 +0000
commit0601fd3d8f9dab900b9fdd7d840837a24530c138 (patch)
tree075159da9acdc60da88c721049fb2559b6644fa5 /src
parentc24e9a53b3dc22babf9fc4a47bd37a8c7689d6f5 (diff)
downloademacs-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.c8
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++ = '.';