Python decimal module for pyboard micro python

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
User avatar
MarkHaysHarris777
Posts: 11
Joined: Wed Apr 29, 2015 11:54 pm

Python decimal module for pyboard micro python

Postby MarkHaysHarris777 » Sat May 02, 2015 8:08 am

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 !
Cheers,
marcus
:)

User avatar
dhylands
Posts: 2374
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: Python decimal module for pyboard micro python

Postby dhylands » Sat May 02, 2015 4:29 pm

I'm not aware of anybody having ported that library to micropython.

micropython already supports arbitrary precision integers, and supports 32-bit floats.

User avatar
pythoncoder
Posts: 1564
Joined: Fri Jul 18, 2014 8:01 am

Re: Python decimal module for pyboard micro python

Postby pythoncoder » Sun May 03, 2015 7:34 am

@MarkHaysHarris777 In the context of microcontroller applications it's a rather specialist requirement so I fear you may have to DIY.
Peter Hinch

User avatar
MarkHaysHarris777
Posts: 11
Joined: Wed Apr 29, 2015 11:54 pm

Re: Python decimal module for pyboard micro python

Postby MarkHaysHarris777 » Fri May 08, 2015 9:34 pm

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
:)

User avatar
kamikaze
Posts: 128
Joined: Tue Aug 16, 2016 10:10 am
Location: СССР
Contact:

Re: Python decimal module for pyboard micro python

Postby kamikaze » Tue Jan 24, 2017 2:18 pm

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?

User avatar
deshipu
Posts: 1036
Joined: Thu May 28, 2015 5:54 pm

Re: Python decimal module for pyboard micro python

Postby deshipu » Tue Jan 24, 2017 2:47 pm

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.


Return to “Development of MicroPython”

Who is online

Users browsing this forum: No registered users and 2 guests