[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preparing the release of Gambas 3.20
[Thread Prev] | [Thread Next]
- Subject: Re: Preparing the release of Gambas 3.20
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Sat, 4 Jan 2025 12:13:14 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
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 -- ## FAILEDAlles Gute Christof Thalhofer
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.
The "=" operator should almost never applied to floating point numbers.It's a difficult problem to compare floating point numbers. Two different floating point numbers may have the same string representation.
For example, you can see in the 'gb.gui.base' 'PaintSmooth' module that implements the algorithm for the new 'Paint.SmoothPolyline()' method, that floating points are compared using that function:
Private Sub SameFloat(X As Float, Y As Float) As Boolean Dim F As Float F = Max(Abs(X), Abs(Y)) If F = 0 Then Return True Else Return Abs(X - Y) / F < 1E-6 Endif End Regards, -- Benoît Minisini.
Gambas Selftest:OldBugs.BugStringToFloatConversion Was: Re: Preparing the release of Gambas 3.20 | Christof Thalhofer <chrisml@xxxxxxxxxxx> |
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> |