def isnan(ctx, x):
        if hasattr(x, "_mpf_"):
            return x._mpf_ == fnan
        if hasattr(x, "_mpc_"):
            return fnan in x._mpc_
        if isinstance(x, int_types) or isinstance(x, rational.mpq):
            return False
        x = ctx.convert(x)
        if hasattr(x, '_mpf_') or hasattr(x, '_mpc_'):
            return ctx.isnan(x)
        raise TypeError("isnan() needs a number as input")
Return *True* if *x* is a NaN (not-a-number), or for a complex
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/ctx_mp_python.py/PythonMPContext.isnan