mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-05 11:21:04 -08:00
(float_to_string): Add `.0' at end if needed.
This commit is contained in:
parent
51ac6f8388
commit
edb2a7079b
1 changed files with 18 additions and 4 deletions
22
src/print.c
22
src/print.c
|
|
@ -581,11 +581,8 @@ to make it write to the debugging output.\n")
|
|||
|
||||
#ifdef LISP_FLOAT_TYPE
|
||||
|
||||
void
|
||||
float_to_string (buf, data)
|
||||
char *buf;
|
||||
/*
|
||||
* This buffer should be at least as large as the max string size of the
|
||||
* The buffer should be at least as large as the max string size of the
|
||||
* largest float, printed in the biggest notation. This is undoubtably
|
||||
* 20d float_output_format, with the negative of the C-constant "HUGE"
|
||||
* from <math.h>.
|
||||
|
|
@ -597,6 +594,10 @@ float_to_string (buf, data)
|
|||
* re-writing _doprnt to be more sane)?
|
||||
* -wsr
|
||||
*/
|
||||
|
||||
void
|
||||
float_to_string (buf, data)
|
||||
char *buf;
|
||||
double data;
|
||||
{
|
||||
register unsigned char *cp, c;
|
||||
|
|
@ -638,6 +639,19 @@ float_to_string (buf, data)
|
|||
|
||||
sprintf (buf, XSTRING (Vfloat_output_format)->data, data);
|
||||
}
|
||||
|
||||
/* Make sure there is a decimal point or an exponent,
|
||||
so that the value is readable as a float. */
|
||||
for (cp = buf; *cp; cp++)
|
||||
if (*cp < '0' || *cp > '9')
|
||||
break;
|
||||
|
||||
if (*cp == 0)
|
||||
{
|
||||
*cp++ = '.';
|
||||
*cp++ = '0';
|
||||
*cp++ = 0;
|
||||
}
|
||||
}
|
||||
#endif /* LISP_FLOAT_TYPE */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue