UniCoreFW

is_nan()

Check if obj is NaN.

Implementation

Args: obj: The object to check Returns: True if obj is NaN, False otherwise

Example

is_nan(float('nan'))

Expected output: True

Source Code

def is_nan(obj: Any) -> bool: return isinstance(obj, float) and math.isnan(obj)