Checking the equality of floating-point variables with ==
is not recommended due to potential inaccuracies. However, the assertion in the following code will be true since y
is assigned the value of x
:
float x = ...
float y = x;
assert(y == x)