Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
3c4c0698
Commit
3c4c0698
authored
Nov 22, 2015
by
Paul Sokolovsky
Browse files
py/formatfloat: Workaround (fix?) incorrect rounding for %f format.
parent
b64e0575
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/formatfloat.c
View file @
3c4c0698
...
...
@@ -308,7 +308,9 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
}
// Round
if
(
f
>=
FPCONST
(
5
.
0
))
{
// If we print non-exponential format (i.e. 'f'), but a digit we're going
// to round by (e) is too far away, then there's nothing to round.
if
((
org_fmt
!=
'f'
||
e
<=
1
)
&&
f
>=
FPCONST
(
5
.
0
))
{
char
*
rs
=
s
;
rs
--
;
while
(
1
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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