Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
9d6128ac
Commit
9d6128ac
authored
Aug 31, 2015
by
Dave Hylands
Committed by
Paul Sokolovsky
Sep 11, 2015
Browse files
stmhal: fix single precision float printing error
Fixes #1435.
parent
e79c6b63
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/formatfloat.c
View file @
9d6128ac
...
...
@@ -142,7 +142,10 @@ int mp_format_float(float f, char *buf, size_t buf_size, char fmt, int prec, cha
char
e_sign_char
=
'-'
;
if
(
num
.
f
<
1
.
0
F
&&
num
.
f
>=
0
.
9999995
F
)
{
num
.
f
=
1
.
0
F
;
first_dig
=
'1'
;
if
(
e
>
1
)
{
// numbers less than 1.0 start with 0.xxx
first_dig
=
'1'
;
}
if
(
e
==
0
)
{
e_sign_char
=
'+'
;
}
...
...
tests/float/float_array.py
View file @
9d6128ac
...
...
@@ -12,3 +12,5 @@ def test(a):
test
(
array
(
'f'
))
test
(
array
(
'd'
))
print
(
'{:.4f}'
.
format
(
array
(
'f'
,
b
'
\xcc\xcc\xcc
='
)[
0
]))
Write
Preview
Supports
Markdown
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