Support asinh/acosh/atanh in the fp context
This commit is contained in:
@@ -125,6 +125,9 @@ class FPContext(StandardBaseContext):
|
||||
cosh = staticmethod(libfp.cosh)
|
||||
sinh = staticmethod(libfp.sinh)
|
||||
tanh = staticmethod(libfp.tanh)
|
||||
acosh = staticmethod(libfp.acosh)
|
||||
asinh = staticmethod(libfp.asinh)
|
||||
atanh = staticmethod(libfp.atanh)
|
||||
gamma = staticmethod(libfp.gamma)
|
||||
rgamma = staticmethod(libfp.rgamma)
|
||||
fac = factorial = staticmethod(libfp.factorial)
|
||||
|
||||
@@ -64,6 +64,10 @@ cosh = _mathfun_real(math.cosh, cmath.cosh)
|
||||
sinh = _mathfun_real(math.sinh, cmath.sinh)
|
||||
tanh = _mathfun_real(math.tanh, cmath.tanh)
|
||||
|
||||
acosh = _mathfun(math.acosh, cmath.acosh)
|
||||
asinh = _mathfun(math.asinh, cmath.asinh)
|
||||
atanh = _mathfun_real(math.atanh, cmath.atanh)
|
||||
|
||||
floor = _mathfun_real(math.floor,
|
||||
lambda z: complex(math.floor(z.real), math.floor(z.imag)))
|
||||
ceil = _mathfun_real(math.ceil,
|
||||
|
||||
@@ -112,6 +112,11 @@ def test_fp_cospi_sinpi():
|
||||
assert ae(fp.sinpi(-0.7+2j), (-216.6116802292079471 - 157.37650009392034693j))
|
||||
assert ae(fp.cospi(-0.7+2j), (-157.37759774921754565 + 216.61016943630197336j))
|
||||
|
||||
def test_fp_asinh_acosh_atanh():
|
||||
assert ae(fp.asinh(0), 0.0)
|
||||
assert ae(fp.acosh(1), 0.0)
|
||||
assert ae(fp.atanh(0), 0.0)
|
||||
|
||||
def test_fp_expj():
|
||||
assert ae(fp.expj(0), (1.0 + 0.0j))
|
||||
assert ae(fp.expj(1), (0.5403023058681397174 + 0.84147098480789650665j))
|
||||
|
||||
Reference in New Issue
Block a user