[Gambas-user] Custom library function returns wrong value

bill-lancaster bill-lancaster at ...2231...
Thu Feb 5 12:13:31 CET 2015


I have a Procedure in MyLib to convert a 'money' string to integer value.

Static Public Procedure StrMoneyToInt(sVal As String) As Integer
Dim f As Float
     f = Val(sVal)
     Return f * 100
End

Some values are incorrectly returned.  For example:-

This code calls the procedure

Dim sMoney As String
     sMoney = "38.37"
     f = Val(sMoney)
     Print f;; f * 100;; MyLib.StrMoneyToInt(sMoney)
Gives:-
38.37 3837 3836

Any ideas?

Gambas3.5.3



--
View this message in context: http://gambas.8142.n7.nabble.com/Custom-library-function-returns-wrong-value-tp50542.html
Sent from the gambas-user mailing list archive at Nabble.com.




More information about the User mailing list