python类e()的实例源码

test_cmath.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
antlang.py 文件源码 项目:antlang4python 作者: AntLang-Software 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _else(maybe_false_if, if_exception):
    try: return maybe_false_if()
    except ConditionalException as e: return if_exception(str(e))
antlang.py 文件源码 项目:antlang4python 作者: AntLang-Software 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _except(maybe_exception, if_exception):
    try: return maybe_exception()
    except Exception as e: return if_exception(str(e))
antlang.py 文件源码 项目:antlang4python 作者: AntLang-Software 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def main(args = sys.argv):
    if len(sys.argv) == 3 and sys.argv[1] == '-f':
        try:
            open_script(sys.argv[2])
        except Exception as e:
            print(e)
    elif len(sys.argv) == 4 and sys.argv[1] == '-f':
        try:
            include(*sys.argv[2:])
        except Exception as e:
            print(e)
    elif len(sys.argv) >= 3 and sys.argv[1] == '-bundle':
        bundle(sys.argv[2], *sys.argv[3:])
    elif len(sys.argv) == 3 and sys.argv[1] == '-e':
        evaluate(sys.argv[2])
    else:
        try: import readline
        except ImportError: pass
        while True:
            try:
                if len(sys.argv) > 1 and sys.argv[1] == '-np':
                    line = input('')
                else:
                    line = input('--> ')
                print(evaluate(line))
            except (EOFError):
                quit()
            except Exception as e:
                print(e)
            except:
                pass

# PyAntLang compatible interface
test_cmath.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
test_cmath.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def check_polar(self, func):
        def check(arg, expected):
            got = func(arg)
            for e, g in zip(expected, got):
                self.rAssertAlmostEqual(e, g)
        check(0, (0., 0.))
        check(1, (1., 0.))
        check(-1, (1., pi))
        check(1j, (1., pi / 2))
        check(-3j, (3., -pi / 2))
        inf = float('inf')
        check(complex(inf, 0), (inf, 0.))
        check(complex(-inf, 0), (inf, pi))
        check(complex(3, inf), (inf, pi / 2))
        check(complex(5, -inf), (inf, -pi / 2))
        check(complex(inf, inf), (inf, pi / 4))
        check(complex(inf, -inf), (inf, -pi / 4))
        check(complex(-inf, inf), (inf, 3 * pi / 4))
        check(complex(-inf, -inf), (inf, -3 * pi / 4))
        nan = float('nan')
        check(complex(nan, 0), (nan, nan))
        check(complex(0, nan), (nan, nan))
        check(complex(nan, nan), (nan, nan))
        check(complex(inf, nan), (inf, nan))
        check(complex(-inf, nan), (inf, nan))
        check(complex(nan, inf), (inf, nan))
        check(complex(nan, -inf), (inf, nan))
test_cmath.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
test_cmath.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def check_polar(self, func):
        def check(arg, expected):
            got = func(arg)
            for e, g in zip(expected, got):
                self.rAssertAlmostEqual(e, g)
        check(0, (0., 0.))
        check(1, (1., 0.))
        check(-1, (1., pi))
        check(1j, (1., pi / 2))
        check(-3j, (3., -pi / 2))
        inf = float('inf')
        check(complex(inf, 0), (inf, 0.))
        check(complex(-inf, 0), (inf, pi))
        check(complex(3, inf), (inf, pi / 2))
        check(complex(5, -inf), (inf, -pi / 2))
        check(complex(inf, inf), (inf, pi / 4))
        check(complex(inf, -inf), (inf, -pi / 4))
        check(complex(-inf, inf), (inf, 3 * pi / 4))
        check(complex(-inf, -inf), (inf, -3 * pi / 4))
        nan = float('nan')
        check(complex(nan, 0), (nan, nan))
        check(complex(0, nan), (nan, nan))
        check(complex(nan, nan), (nan, nan))
        check(complex(inf, nan), (inf, nan))
        check(complex(-inf, nan), (inf, nan))
        check(complex(nan, inf), (inf, nan))
        check(complex(nan, -inf), (inf, nan))
test_cmath.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
AdaBoost.py 文件源码 项目:statistical-learning-methods-note 作者: ysh329 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def computeBaseClassifierCoefficient(self, classifierIdx):
        '''
        ???????????????(?0??)???????????? alpha ?
        :param classifierIdx: ???????(?0??)
        :return:
        '''
        self.alphaList[classifierIdx] = (1.0 / 2 * \
                                         cmath.log((1.0-self.eList[classifierIdx])/self.eList[classifierIdx], cmath.e)\
                                         ).real
test_cmath.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
test_cmath.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
test_cmath.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def check_polar(self, func):
        def check(arg, expected):
            got = func(arg)
            for e, g in zip(expected, got):
                self.rAssertAlmostEqual(e, g)
        check(0, (0., 0.))
        check(1, (1., 0.))
        check(-1, (1., pi))
        check(1j, (1., pi / 2))
        check(-3j, (3., -pi / 2))
        inf = float('inf')
        check(complex(inf, 0), (inf, 0.))
        check(complex(-inf, 0), (inf, pi))
        check(complex(3, inf), (inf, pi / 2))
        check(complex(5, -inf), (inf, -pi / 2))
        check(complex(inf, inf), (inf, pi / 4))
        check(complex(inf, -inf), (inf, -pi / 4))
        check(complex(-inf, inf), (inf, 3 * pi / 4))
        check(complex(-inf, -inf), (inf, -3 * pi / 4))
        nan = float('nan')
        check(complex(nan, 0), (nan, nan))
        check(complex(0, nan), (nan, nan))
        check(complex(nan, nan), (nan, nan))
        check(complex(inf, nan), (inf, nan))
        check(complex(-inf, nan), (inf, nan))
        check(complex(nan, inf), (inf, nan))
        check(complex(nan, -inf), (inf, nan))
test_cmath.py 文件源码 项目:ndk-python 作者: gittor 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
test_cmath.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_constants(self):
        e_expected = 2.71828182845904523536
        pi_expected = 3.14159265358979323846
        self.assertAlmostEqual(cmath.pi, pi_expected, places=9,
            msg="cmath.pi is {}; should be {}".format(cmath.pi, pi_expected))
        self.assertAlmostEqual(cmath.e, e_expected, places=9,
            msg="cmath.e is {}; should be {}".format(cmath.e, e_expected))
antlang.py 文件源码 项目:Julus 作者: AntLang-Software 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _else(maybe_false_if, if_exception):
    try: return maybe_false_if()
    except ConditionalException as e: return if_exception(str(e))
antlang.py 文件源码 项目:Julus 作者: AntLang-Software 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _except(maybe_exception, if_exception):
    try: return maybe_exception()
    except Exception as e: return if_exception(str(e))
antlang.py 文件源码 项目:Julus 作者: AntLang-Software 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def main(args = sys.argv):
    if len(sys.argv) == 3 and sys.argv[1] == '-f':
        try:
            open_script(sys.argv[2])
        except Exception as e:
            print(e)
    elif len(sys.argv) == 4 and sys.argv[1] == '-f':
        try:
            include(*sys.argv[2:])
        except Exception as e:
            print(e)
    elif len(sys.argv) >= 3 and sys.argv[1] == '-bundle':
        bundle(sys.argv[2], *sys.argv[3:])
    elif len(sys.argv) == 3 and sys.argv[1] == '-e':
        evaluate(sys.argv[2])
    else:
        try: import readline
        except ImportError: pass
        while True:
            try:
                if len(sys.argv) > 1 and sys.argv[1] == '-np':
                    line = input('')
                else:
                    line = input('--> ')
                print(evaluate(line))
            except (EOFError):
                quit()
            except Exception as e:
                print(e)
            except:
                pass

# Julus `do` interface


问题


面经


文章

微信
公众号

扫码关注公众号