test_cma.py

来自「minimal python variant for small footpri」· Python 代码 · 共 36 行

PY
36
字号
#! /usr/bin/env python""" Simple test script for cmathmodule.c    Roger E. Masse"""import cmathfrom test_support import verbosetestdict = {'acos' : 1.0,            'acosh' : 1.0,            'asin' : 1.0,            'asinh' : 1.0,            'atan' : 0.2,            'atanh' : 0.2,            'cos' : 1.0,            'cosh' : 1.0,            'exp' : 1.0,            'log' : 1.0,            'log10' : 1.0,            'sin' : 1.0,            'sinh' : 1.0,            'sqrt' : 1.0,            'tan' : 1.0,            'tanh' : 1.0}for func in testdict.keys():    f = getattr(cmath, func)    r = f(testdict[func])    if verbose:        print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r))p = cmath.pie = cmath.eif verbose:    print 'PI = ', abs(p)    print 'E = ', abs(e)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?