comparison src/print.c @ 1764:94ff5d9ef48a

(float_to_string): Add final 0 if text ends with decimal pt.
author Richard M. Stallman <rms@gnu.org>
date Wed, 13 Jan 1993 00:25:03 +0000
parents 3c615a9dcd64
children 239a8c1cb40f
comparison
equal deleted inserted replaced
1763:65e858c07a8b 1764:94ff5d9ef48a
638 goto lose; 638 goto lose;
639 639
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
649 if (*cp == '.' && cp[1] == 0)
650 {
651 cp[1] = '0';
652 cp[2] = 0;
653 }
648 654
649 if (*cp == 0) 655 if (*cp == 0)
650 { 656 {
651 *cp++ = '.'; 657 *cp++ = '.';
652 *cp++ = '0'; 658 *cp++ = '0';