Greetings, I have read the contributor guidelines for micro python, and I think I get it; that is just as a preface for my inquiry. At this point I don't have enough core knowledge to recommend changes of *any* kind to micro python. But I do know that I want to import the C decimal module (C Python 3) for my project with micro python ( I need arbitrary precision scientific maths, and I want to use my own pdeclib, which relies on the C decimal module).
So, basically, I am wanting to know what I need to do to get the decimal module 'ported' to micro python. Has this been done and available for add-on or plug-in from a repository, or would I need to compile the sources (port it myself) ? Has anyone else thought about this, and is anyone else working on it?
TIA
PS I am having a 'blast' with my pyboard... just brilliant !
Python decimal module for pyboard micro python
- MarkHaysHarris777
- Posts: 11
- Joined: Wed Apr 29, 2015 11:54 pm
Python decimal module for pyboard micro python
Cheers,
marcus
marcus
Re: Python decimal module for pyboard micro python
I'm not aware of anybody having ported that library to micropython.
micropython already supports arbitrary precision integers, and supports 32-bit floats.
micropython already supports arbitrary precision integers, and supports 32-bit floats.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Python decimal module for pyboard micro python
@MarkHaysHarris777 In the context of microcontroller applications it's a rather specialist requirement so I fear you may have to DIY.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
- MarkHaysHarris777
- Posts: 11
- Joined: Wed Apr 29, 2015 11:54 pm
Re: Python decimal module for pyboard micro python
Thanks guys, for the replies; DIY is ok, and I'm pumped about it (on the back burner), I just thought someone else may have tackled it, and I'm less about reinventing the decimal bignums if I don't have to. Thanks again.
Cheers,
marcus
marcus
Re: Python decimal module for pyboard micro python
I'm going to work with GPS coordinates. Float numbers do not look quiet precise. So if there is no Decimal implemented... is it a good idea to use Integer?
Re: Python decimal module for pyboard micro python
I think so. MicroPython's integer can be arbitrarily large (as long as you have the memory), so you can scale them to the resolution you need.
Re: Python decimal module for pyboard micro python
I can see that this thread is old, but this information might be useful for someone.
This a Decimal floating point arithmetic for micropython that I developed. It is available on GitHub.
This a Decimal floating point arithmetic for micropython that I developed. It is available on GitHub.