isInf (float)
TheisInf node checks if the input float value is positive or negative infinity. It returns true if the input is either positive or negative infinity, and false otherwise.
Inputs
a(float, default: 0): The float value to check for infinity.
Outputs
result(boolean): Returnstrueif the input is either positive or negative infinity, andfalseotherwise.
Configuration
This node has no configuration options.Example Usage
Suppose you have a spell that performs a series of mathematical operations on a float value. You want to check if the result of these operations is infinity before proceeding with further calculations. You can use theisInf node to accomplish this.
Spell Steps
- Connect the output of your mathematical operation nodes to the
ainput of theisInfnode. - Connect the
resultoutput of theisInfnode to aBranchnode. - Configure the
Branchnode to handle the case whenresultistrue(infinity) and when it isfalse(not infinity).
Example Spell
In this example, theisInf node is used to check if the result of the mathematical operations is infinity. If it is, the spell branches to handle the infinity case. If not, the spell continues with further calculations.
Best Practices
- Use the
isInfnode to check for infinity when working with float values that may grow very large or very small during calculations. - Always handle the case when
resultistrueto avoid unexpected behavior in your spell.
Common Issues
- Be aware that the
isInfnode only checks for positive and negative infinity. It does not check for NaN (Not-a-Number) values. Use theisNaNnode for that purpose. - Remember that comparing a float value directly to infinity using the equality operator (
==) may not always work due to the way floats are represented in memory. TheisInfnode provides a reliable way to check for infinity.
