Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7036

MicroPython • Re: int() doing odd things.

$
0
0
If other functions print 1.0, then they may be using 6 digits of output, which sucks if the leading digit is 1
Yes that's my main concern. We really have two separate issues here, which combined creates a great deal of confusion -
  • The accuracy of 'math.log2()' results
  • The accuracy and correctness of 'str()', 'repr()' and REPL reporting whatever those results are.
The impact of that second extends far beyond just 'math.log2()'. The way I see it; processing a float directly should give the same result as processing that float when converted to a string. If not it's a nightmare scenario. And that's what we seem to have with MicroPython.

There is no doubt an explanation for why it is how it is, maybe some reason why it is that way, but I can't deem it as correct, don't believe I ever could.

And thanks for the links; I haven't found the time yet to do my own digging.

Statistics: Posted by hippy — Mon Apr 28, 2025 1:22 pm



Viewing all articles
Browse latest Browse all 7036

Trending Articles