Just started to play with LoPy and have a problem explained below. It is not LoPy specific but related to MicroPython I guess, it is why asking here.
machine.freq()[0] / 1000 / 1000 returns 80.00003 which is OK
But
machine.freq()[0] / 1000000 returns 8.181962e-07
which doesn't look the right result
machine.freq()[0] / 1000000.0
machine.freq()[0] / 1e6
returns the same. What is wrong?
Regards... Béla
Question on arithmetic calculations
Question on arithmetic calculations
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)
HAM radio call: HA5DI (Béla)
Re: Question on arithmetic calculations
Now I remember, several month ago there was an issue opened at GitHub about a similar issue if I'm right. It looks the same here.
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)
HAM radio call: HA5DI (Béla)
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Question on arithmetic calculations
For what it's worth all of those tests on the Pyboard return the correct value (168.0).
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Question on arithmetic calculations
On the WiPy 2.0, machine.freq()[0] / 1000 / 1000 returns 80.00003,
and machine.freq()[0] / 1000000 returns 8.181962e-07 - same problem as reported for the LoPy.
and machine.freq()[0] / 1000000 returns 8.181962e-07 - same problem as reported for the LoPy.
Re: Question on arithmetic calculations
Without knowing anything about the config settings in their build (eg what object representation they use) it's really hard to answer questions like this.
Re: Question on arithmetic calculations
My experiment was using a WiPy 2.0 with build 0.9.0.b2, as updated recently using the 'Pycom Firmware Update' program.
Jim
Jim
Re: Question on arithmetic calculations
Sorry, this doesn't help. What I meant was that, because the code for WiPy/LoPy/SiPy is not open source, only Pycom themselves know how their version of MicroPython is configured, and only they can answer and fix things like this.jgmdavies wrote:My experiment was using a WiPy 2.0 with build 0.9.0.b2, as updated recently using the 'Pycom Firmware Update' program.
Re: Question on arithmetic calculations
Reported the issue at the Pycom forum, Daniel confirmed the bug.
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)
HAM radio call: HA5DI (Béla)