[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gambas-bugtracker] Bug #2921: Postgresql 19.900000000000055 is 20 in Gambas


http://gambaswiki.org/bugtracker/edit?object=BUG.2921&from=L21haW4-

Comment #2 by Christof THALHOFER:

19.900000000000055::double precision is Float in Gambas but Gambas makes 20 out of it!
19.90000000000001::double precision is correctly shown as 19.9

This is very, very bad because we cannot rely on Gambas as a DB forntend any more, I am quite sure it didn't happen before 3.19.

Here is the test:

----------------------------------------

Public Sub BugPostgresNineteenNinetyIsTwenty()
    
    Dim qry As String
    Dim res As Result
    

    ' this fails
    qry = "Select 19.900000000000055::double precision as price;"
    res = $Con.Exec(qry)
    Assert.RelativeApproximate(res!price, 19.90, 0.001)

    ' this is ok    
    qry = "Select 19.90000000000001::double precision as price;"
    res = $Con.Exec(qry)
    Assert.RelativeApproximate(res!price, 19.90, 0.001)
    
End
----------------------------------------


----[ Gambas bugtracker-list is hosted by https://www.hostsharing.net ]----