≈ (LogiX node)
≈ | ||
---|---|---|
Inputs | ||
Float | A | |
Float | B | |
Float | Epsilon | |
Outputs | ||
Bool | * |
The ≈ node, known as the Approximately node, checks whether inputs A and B are approximately equal. If they are within the margin of error specified by the Epsilon input this node outputs True, otherwise False.
Usage
Due to the fact that decimal numbers often cannot be precisely encoded in binary it is unreliable to use the == (LogiX node) to attempt to test whether two floating point numbers are exactly equal. This node can be used in this situation to check whether two floating point numbers are approximately equal. Note that the output can sometimes be counterintuitive, again due to the inability to precisely encode decimal numbers in binary. For example, 0 and 0.5 are reported as not equal with an Epsilon of 0.5. However 0.4 and 0.9, where the difference is again 0.5, are reported as equal with the same Epsilon value.
This node can be overloaded to accept vector inputs at A and B (e.g. float 3). In that case equality comparisons are performed element-wise using the same Epsilon value for each.
Other nodes which can often be used in place of this node are ≤ or ≥.