Skip to content

More MicroPython float format fixes#6776

Closed
dhalbert wants to merge 2 commits into
adafruit:mainfrom
dhalbert:micropython-float-format-2
Closed

More MicroPython float format fixes#6776
dhalbert wants to merge 2 commits into
adafruit:mainfrom
dhalbert:micropython-float-format-2

Conversation

@dhalbert
Copy link
Copy Markdown
Collaborator

Fixes #6748: incorporate addition floating-point format fixes from MicroPython. Cherry-picked two commits from upstream. One required some merge fixes, maybe due to an upstream rebase. Verified that latest version now matches upstream except for a comment change.

dpwe and others added 2 commits August 17, 2022 16:50
Rework the conversion of floats to decimal strings so it aligns precisely
with the conversion of strings to floats in parsenum.c.  This is to avoid
rendering 1eX as 9.99999eX-1 etc.  This is achieved by removing the power-
of-10 tables and using pow() to compute the exponent directly, and that's
done efficiently by first estimating the power-of-10 exponent from the
power-of-2 exponent in the floating-point representation.

Code size is reduced by roughly 100 to 200 bytes by this commit.

Signed-off-by: Dan Ellis <dan.ellis@gmail.com>
@dhalbert
Copy link
Copy Markdown
Collaborator Author

Forget about doing this now; just wait for the next merge. It turns out it depends on some other previous commits, and is not easy to cherry-pick.

@dhalbert dhalbert closed this Aug 17, 2022
@dhalbert dhalbert deleted the micropython-float-format-2 branch August 17, 2022 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorporate micropython #8985: py/formatfloat

2 participants