- 1

What is the infuriating bug?

13th Dec 2017, 9:09 PM
Omar
Omar - avatar
7 Antworten
+ 4
ptThree = 0.1 + 0.1 + 0.1 print( ptThree == 0.3 ) Output: False (it's actually 0.30000000000000004)
14th Dec 2017, 1:45 AM
Kirk Schafer
Kirk Schafer - avatar
+ 4
Run this code. Leave seeds/amount at 0,1 / 99 and generate. Check the Phi offsets (ratios section). Starting at #41, they're all ZERO ... we matched, no more precision problems, right? Then at #79, 82, 89, 95 ... the error comes back (disappears, moves around)...after the ratio is supposed to have "settled": https://code.sololearn.com/W0izfx5FISNx/?ref=app (I believe the offset is "epsilon" at that magnitude, a float precision metric... so are #39 and 40 ok? Do I have to check for this as a possible bug? Why do I need to know this, can I just truncate, etc.)
21st Dec 2017, 11:13 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Because it's "obvious" (0.1 + 0.1 + 0.1) == 0.3, it may never occur to someone that the reasoning is fundamentally incorrect. Worse, the deviation depends on combinations, so it moves, vanishes, reappears, works over there but not here ... that might be infuriating.
14th Dec 2017, 9:03 PM
Kirk Schafer
Kirk Schafer - avatar
0
I am sorry but I still not understand what is the meaning of infuriating bug??
14th Dec 2017, 7:13 PM
Omar
Omar - avatar
0
what is moving and vanishing and reappears ???
21st Dec 2017, 11:01 PM
Omar
Omar - avatar
- 2
go to python then basic concepts then floats u will find this sentece (Computers can't store floats perfectly accurately, in the same way that we can't write down the complete decimal expansion of 1/3 (0.3333333333333333...). Keep this in mind, because it often leads to infuriating bugs!) So what is the meaning of infuriating bugs ?
13th Dec 2017, 10:05 PM
Omar
Omar - avatar