Page 1 of 1

Maximum and minimum int and float values?

Posted: Sun Jan 17, 2021 8:41 pm
by MicroGuy
New member here... What is the range of integer and floating-point values available in MicroPython? I could not find these specifications in any online information after an hour of search time. Thanks --Jon

Re: Maximum and minimum int and float values?

Posted: Sun Jan 17, 2021 10:02 pm
by dhylands
It depends.

There are several different ways of configuring micropython.

The standard pyboard (STM32F405) has a notion of small ints which can store 31-bit signed integers. It also supports MPZ (multi-prrecision) which is essentually infinite precision integers, limited only by available memory.

MicroPython can be configured with single (32-bit) or double (64-bit) precision floating point numbers. The pyboard uses 32-bit by default since the hardware FPU supports 32-bit. You can recompile it to use double precision but then does everything in software. Other MCUs may support double precision in HW.

You can also see some configuration options here:
https://github.com/micropython/micropyt ... nfig.h#L69

Re: Maximum and minimum int and float values?

Posted: Sun Jan 17, 2021 10:08 pm
by MicroGuy
Thanks for your help, Dave. I appreciate your clarifications. --Jon