Rpi Pico : Double precision as default #9517
Replies: 2 comments 2 replies
-
On other ports (e.g. stm32, and in particular the pyboard firmware) we provide double-precision as an option by providing two different firmware images. We've recently added support for board variants to the rp2 port, so it would be possible to add this for e.g. the Pico board. In general we only enable double-precision by default if the chip has hardware support for it. For some more context, the rp2040 doesn't have any hardware floating point (either single or double), rather both are implemented in software in the mask ROM. See https://github.com/raspberrypi/pico-bootrom/blob/master/bootrom/mufplib.S (for the single-precision implementation, the double-precision implementation is in the same directory). So perhaps you could argue that the rp2040 is equivalent to having hardware double-precision support. In terms of the runtime cost, the MicroPython overheads likely exceed any difference in computation time, although it would be worthwhile running the performance tests to compare, as well as a code size diff. |
Beta Was this translation helpful? Give feedback.
-
It would be interesting to run the performance benchmark suite to compare single with double precision. There are some tests in that suite that do exercise floats. Also just to note that using double shouldn't increase heap usage, a Python float object will still be 16 bytes big (1 GC block). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
In micropython of RPI Pico board, I see, single precision
floating point number is the default type for the floating
point numbers.
I think, double should be default for following reasons.
in single precision cause significant loss of accuracy.
and faster development. This is a trade off with performance.
We accepted this when we choose microPython.
compared other uC of similar price range/package range.
So, we need to more liberal when float Vs Double discussion comes
to such new class of uC.
Hence, I request the maintainers to include double as default for pico.
Reference diff (ignore unix port change in this):
master...prabhu-yu:micropython:megha-dev
I wish to submit a PR for this. Before this, I wanted to understand
others thoughts on this.
Beta Was this translation helpful? Give feedback.
All reactions