Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
edb2a707
Commit
edb2a707
authored
Jan 10, 1993
by
Richard M. Stallman
Browse files
(float_to_string): Add `.0' at end if needed.
parent
51ac6f83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
src/print.c
src/print.c
+18
-4
No files found.
src/print.c
View file @
edb2a707
...
@@ -581,11 +581,8 @@ to make it write to the debugging output.\n")
...
@@ -581,11 +581,8 @@ to make it write to the debugging output.\n")
#ifdef LISP_FLOAT_TYPE
#ifdef LISP_FLOAT_TYPE
void
float_to_string
(
buf
,
data
)
char
*
buf
;
/*
/*
* Th
is
buffer should be at least as large as the max string size of the
* Th
e
buffer should be at least as large as the max string size of the
* largest float, printed in the biggest notation. This is undoubtably
* largest float, printed in the biggest notation. This is undoubtably
* 20d float_output_format, with the negative of the C-constant "HUGE"
* 20d float_output_format, with the negative of the C-constant "HUGE"
* from <math.h>.
* from <math.h>.
...
@@ -597,6 +594,10 @@ float_to_string (buf, data)
...
@@ -597,6 +594,10 @@ float_to_string (buf, data)
* re-writing _doprnt to be more sane)?
* re-writing _doprnt to be more sane)?
* -wsr
* -wsr
*/
*/
void
float_to_string
(
buf
,
data
)
char
*
buf
;
double
data
;
double
data
;
{
{
register
unsigned
char
*
cp
,
c
;
register
unsigned
char
*
cp
,
c
;
...
@@ -638,6 +639,19 @@ float_to_string (buf, data)
...
@@ -638,6 +639,19 @@ float_to_string (buf, data)
sprintf
(
buf
,
XSTRING
(
Vfloat_output_format
)
->
data
,
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 */
#endif
/* LISP_FLOAT_TYPE */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment