Here is a little riddle for you. Given the following code, what does B4A return?
You'd expect 12.34, right? The conversion from the string to the floating point numeric value should have dropped the last 0.
Well, it turns out the result that appears in the log is
Some kind of rounding error? What's going on here and how can I get the "12.34" I want?
B4X:
Dim s As String
s="12.340"
Dim f As Float
f=s
Log(f)
You'd expect 12.34, right? The conversion from the string to the floating point numeric value should have dropped the last 0.
Well, it turns out the result that appears in the log is
B4X:
12.34000015258789
Some kind of rounding error? What's going on here and how can I get the "12.34" I want?