Equal
Float
Equal (Float)
The Equal (Float) node compares two floating-point numbers and outputs a boolean value indicating whether they are equal.
Inputs
a
(float, default: 0): The first floating-point number to compare.b
(float, default: 0): The second floating-point number to compare.
Outputs
result
(boolean): The result of the equality comparison. Returnstrue
ifa
is equal tob
, andfalse
otherwise.
Configuration
This node has no configuration options.
Usage
The Equal (Float) node is used to determine if two floating-point numbers are equal. It is particularly useful in conditional statements or for validating user input.
To use the Equal (Float) node:
- Connect the first floating-point number to the
a
input. - Connect the second floating-point number to the
b
input. - The
result
output will emittrue
if the two input numbers are equal, andfalse
otherwise.
Example
Here’s an example of how to use the Equal (Float) node in a spell:
In this example, two input/number
nodes provide the floating-point numbers to compare. The Equal (Float) node compares these numbers and passes the boolean result to an output/boolean
node.
Best Practices
- Ensure that the inputs to the Equal (Float) node are actually floating-point numbers. Connecting other data types may lead to unexpected behavior.
- Keep in mind that floating-point comparisons can sometimes be imprecise due to the way computers represent decimal numbers. For more precise comparisons, consider using the Equal (String) node with string representations of the numbers.
Common Issues
- If the Equal (Float) node always returns
false
, double-check that the input values are the expected floating-point numbers and that they are truly equal. Slight variations in the decimal places can cause the equality check to fail.