[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Gambas Selftest:OldBugs.BugStringToFloatConversion Was: Re: Preparing the release of Gambas 3.20
[Thread Prev] | [Thread Next]
- Subject: Gambas Selftest:OldBugs.BugStringToFloatConversion Was: Re: Preparing the release of Gambas 3.20
- From: Christof Thalhofer <chrisml@xxxxxxxxxxx>
- Date: Sun, 5 Jan 2025 08:16:41 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Am 04.01.25 um 12:13 schrieb Benoît Minisini:
Le 04/01/2025 à 09:48, Christof Thalhofer a écrit :Am 04.01.25 um 01:44 schrieb Benoît Minisini:And for sure someone will find last minute blocking bugs...You could find one by yourself if you would have ran './test-fast'.# 2 tests failed: # 2: OldBugs.BugStringToFloatConversion.25 -- # 4: OldBugs.BugStringToFloatConversion.29 -- # # FAILED
...
This test is problematic. You cannot be sure that `Round(19.9,-2) = 19.9`, because 19.9 has no exact binary representation, neither 10^-2. As the algorithm of Round() slightly changed, the test does not pass anymore.
Thank you for the explanation. I am not a mathematician.We have an explicit test for Float. What if we do this in Gambas3 Selftest:OldBugs.BugStringToFloatConversion?
--------------------------------------------------------- Public Sub BugStringToFloatConversion() Dim f As Float f = 19.900000000000055 Assert.Equals(f, 19.9000000000001) Assert.Approximate(Round(f, -2), 19.9, 1E-14) f = 19.9000000000001 Assert.Equals(f, 19.9000000000001) Assert.Approximate(Round(f, -2), 19.9, 1E-14) End --------------------------------------------------------- This test passes. Alles Gute Christof Thalhofer -- Dies ist keine Signatur
Preparing the release of Gambas 3.20 | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: Preparing the release of Gambas 3.20 | Christof Thalhofer <chrisml@xxxxxxxxxxx> |
Re: Preparing the release of Gambas 3.20 | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |