Using stock MicroPython -perhaps this helps:
viewtopic.php?t=319525
Code:
MicroPython v1.26.0-preview.142.ga1ee42cd3.dirty on 2025-05-21; Raspberry Pi Pico 2 W with RP2350Type "help()" for more information.>>> 1234.20 * 100123420.0>>> int(1234.20 * 100)123419>>> int("{:.0f}".format(1234.20 * 100))123420As can be seen in that last case MicroPython is entirely capable of doing the conversion correctly, it's just that using 'int' on a float doesn't.
Going to double-precision works around that issue but means having to build and use non-standard firmware and one's code won't work for any other user who hasn't done that. I would recommend using a workround as above.
Statistics: Posted by hippy — Fri Jul 04, 2025 2:53 pm