Skip to content

Commit

Permalink
overload with c32/c64 for hyperbolic functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Mar 19, 2022
1 parent 39cac2b commit 742ee38
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions integration_tests/test_cmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ def test_hyperbolic():
y = cosh(x)
y = sinh(x)
y = tanh(x)
a: c32
b: c32
a = complex(3, 3)
b = acosh(a)
b = asinh(a)
b = atanh(a)
b = cosh(a)
b = sinh(a)
b = tanh(a)


test_power_logarithmic()
Expand Down
51 changes: 51 additions & 0 deletions src/runtime/cmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,45 +157,96 @@ def tan(x: c32) -> c32:
def _lfortran_zacosh(x: c64) -> c64:
pass

@ccall
def _lfortran_cacosh(x: c32) -> c32:
pass

@overload
def acosh(x: c64) -> c64:
return _lfortran_zacosh(x)

@overload
def acosh(x: c32) -> c32:
return _lfortran_cacosh(x)

@ccall
def _lfortran_zasinh(x: c64) -> c64:
pass

@ccall
def _lfortran_casinh(x: c32) -> c32:
pass

@overload
def asinh(x: c64) -> c64:
return _lfortran_zasinh(x)

@overload
def asinh(x: c32) -> c32:
return _lfortran_casinh(x)

@ccall
def _lfortran_zatanh(x: c64) -> c64:
pass

@ccall
def _lfortran_catanh(x: c32) -> c32:
pass

@overload
def atanh(x: c64) -> c64:
return _lfortran_zatanh(x)

@overload
def atanh(x: c32) -> c32:
return _lfortran_catanh(x)


@ccall
def _lfortran_zcosh(x: c64) -> c64:
pass

@ccall
def _lfortran_ccosh(x: c32) -> c32:
pass

@overload
def cosh(x: c64) -> c64:
return _lfortran_zcosh(x)

@overload
def cosh(x: c32) -> c32:
return _lfortran_ccosh(x)

@ccall
def _lfortran_zsinh(x: c64) -> c64:
pass

@ccall
def _lfortran_csinh(x: c32) -> c32:
pass

@overload
def sinh(x: c64) -> c64:
return _lfortran_zsinh(x)

@overload
def sinh(x: c32) -> c32:
return _lfortran_csinh(x)


@ccall
def _lfortran_ztanh(x: c64) -> c64:
pass

@ccall
def _lfortran_ctanh(x: c32) -> c32:
pass

@overload
def tanh(x: c64) -> c64:
return _lfortran_ztanh(x)

@overload
def tanh(x: c32) -> c32:
return _lfortran_ctanh(x)

0 comments on commit 742ee38

Please sign in to comment.