Hi Everybody,
I am trying to compare single precision floating point values in VB .NET. The code runs ok but the results look not right. Results also contain -Inf values. I see that this is not the right way of comparing floating points. Could you please show me how to compare these? Thank you so much.
For m = 0 To fLen1 - 1
If snglRead1(m) >= -1.0 And snglRead1(m) <= -0.18 Then
snglOutput(m) = 0.985
ElseIf snglRead1(m) > -0.18 And snglRead1(m) <= 0.157 Then
snglOutput(m) = 0.955
ElseIf snglRead1(m) > 0.157 And snglRead1(m) <= 0.727 Then
snglOutput(m) = Math.Log(snglOutput(m))
ElseIf snglRead1(m) > 0.727 And snglRead1(m) <= 1.0 Then
snglOutput(m) = 0.99
End If
bw.Write(snglOutput(m))
Next