문제

I have some problems with the inequality operators.

Consider the code below:

If a >= 0.00000001 Then
            ' action statement
End If

a variable is a Single and a = 0.00000001.

When I run the if condition using Microsoft Visual Basic 2010 Express, the Immediate Windows says it is false. I have inserted a screenshot for your reference. Screenshot

Do you know what is the root cause of this issue and how do I solve it?

Thank you

도움이 되었습니까?

해결책

Floating-point math is not exact. It's an approximation.

There's more to it here: http://floating-point-gui.de/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top