Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)

            def f(x, **kwargs):
        if type(x) is float:
            return f_real(x)
        if type(x) is complex:
            return f_complex(x)
        try:
            x = float(x)
            return f_real(x)
        except (TypeError, ValueError):
            x = complex(x)
            return f_complex(x)
        


src/s/y/sympy-0.7.5/sympy/mpmath/tests/test_fp.py   sympy(Download)
    assert ae(fp.im(2.5), 0.0)
    assert ae(fp.im(2.5+3j), 3.0)
    assert ae(fp.floor(2.5), 2.0)
    assert ae(fp.floor(2), 2.0)
    assert ae(fp.floor(2.0+0j), (2.0 + 0.0j))
    assert ae(fp.floor(-1.5-0.5j), (-2.0 - 1.0j))

src/s/y/sympy-HEAD/sympy/mpmath/tests/test_fp.py   sympy(Download)
    assert ae(fp.im(2.5), 0.0)
    assert ae(fp.im(2.5+3j), 3.0)
    assert ae(fp.floor(2.5), 2.0)
    assert ae(fp.floor(2), 2.0)
    assert ae(fp.floor(2.0+0j), (2.0 + 0.0j))
    assert ae(fp.floor(-1.5-0.5j), (-2.0 - 1.0j))

src/s/y/sympy-polys-HEAD/sympy/mpmath/tests/test_fp.py   sympy-polys(Download)
    assert ae(fp.im(2.5), 0.0)
    assert ae(fp.im(2.5+3j), 3.0)
    assert ae(fp.floor(2.5), 2.0)
    assert ae(fp.floor(2), 2.0)
    assert ae(fp.floor(2.0+0j), (2.0 + 0.0j))
    assert ae(fp.floor(-1.5-0.5j), (-2.0 - 1.0j))