Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
6b74d7d8
Commit
6b74d7d8
authored
Jul 03, 2003
by
Michael Beck
Browse files
integer floating point values will be printed witha .0 appended
[r1437]
parent
0b08729e
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/tv/fltcalc.c
View file @
6b74d7d8
...
...
@@ -170,11 +170,24 @@ int fc_comp(const void *a, const void *b)
char
*
fc_print_dec
(
const
void
*
a
,
char
*
buf
,
int
buflen
)
{
int
n
;
#ifdef USE_LONG_DOUBLE
snprintf
(
buf
,
buflen
,
"%1.30Lg"
,
CAST_IN
(
a
));
n
=
snprintf
(
buf
,
buflen
,
"%1.30Lg"
,
CAST_IN
(
a
));
#else
snprintf
(
buf
,
buflen
,
"%1.30g"
,
CAST_IN
(
a
));
n
=
snprintf
(
buf
,
buflen
,
"%1.30g"
,
CAST_IN
(
a
));
#endif
if
(
n
>
-
1
&&
n
<
buflen
)
{
/*
* for some backends we always want to present 0 as 0.0
* as I could not find the best format to express this, add
* a .0 explicitely if not found
*/
if
(
NULL
==
strrchr
(
buf
,
'.'
))
strncat
(
buf
,
".0"
,
buflen
);
}
return
buf
;
}
...
...
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