← index #938Issue #233
Related · high · value 0.406
QUERY · ISSUE

Add support for stdlib decimal.Decimal

openby erichigginsopened 2024-11-19updated 2025-07-15
enhancement

I'd like to request adding the decimal standard library to micropython-lib.
https://docs.python.org/3/library/decimal.html

It's particularly useful for parsing and maintaining precision when reading values from peripherals (in my case, analytical balances) and displaying them on a screen without worrying about the issues associated with floating point arithmetic.

1 comment
jonnor · 2025-07-15

This would be nice to have indeed!

CANDIDATE · ISSUE

datetime implementation

closedby xrmxopened 2017-11-11updated 2017-12-29

Opened the issue to avoid other people trying to port Cpython's pure python datetime
implementation and find out that is blocked by the following micropython issue: https://github.com/micropython/micropython/pull/3391

That specific datetime implementation needs:

  • time.strptime

And cpython tests need:

  • decimal.Decimal
  • test.support.is_resource_enabled
  • test.support.requires_IEEE_754
  • test.support.run_with_tz
  • random.randrange (aliasing urandom)
6 comments
pfalcon · 2017-11-11

As the quoted ticket hints, I have the patches in my tree, and will push the for review (or directly to the repo) when other things in the queue are processed.

xrmx · 2017-11-11

Cool, thanks! is there any of the requirements that has not been developed yet?

pfalcon · 2017-11-11

So, I pushed the baseline CPython files to master, then https://github.com/micropython/micropython-lib/pull/234 presents my current patchset on top of that.

pfalcon · 2017-11-11

randrange() is discussed in https://github.com/micropython/micropython-lib/pull/208

pfalcon · 2017-12-28

Merged to mainline.

xrmx · 2017-12-29

Thanks!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied