I can accept that. But why does 'str()' and 'repr()', and whatever the REPL uses to show the result, show that as "13.0" ?Hence your result. It's FP being a weird little guy again. Not a bug.Code:
>>> "%.12f"%math.log2(8192)'12.999999046326'
I would argue they are all lying to me in not telling me what value this float actually has.
It seems to me that MicroPython 32-bit floats have maybe 7 digits of resolution ...
Code:
>>> if True:... # 123456789... "{:.64f}".format(1.000001)... "{:.64f}".format(1.0000001)... "{:.64f}".format(1.00000001)...'1.00000095367431640625000000000''1.00000011920928955078125000000''1.00000000000000000000000000000'
If any of my software were doing that I'd class it as a bug. It's at least funky unexpected behaviour to me.
I will maybe have to do some digging.
Statistics: Posted by hippy — Mon Apr 28, 2025 12:33 am