Skip to content

Commit

Permalink
Remove rect from lfortran_intrinsics.c
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 committed Apr 3, 2023
1 parent c74f00c commit 29737ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
10 changes: 0 additions & 10 deletions src/libasr/runtime/lfortran_intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,6 @@ LFORTRAN_API double _lfortran_zphase(double_complex_t x)
return atan2(cimag(x), creal(x));
}

// rect --------------------------------------------------------------------

LFORTRAN_API double_complex_t _lfortran_rect(double r, double phi)
{
double re = r*cos(phi);
double im = r*sin(phi);
double complex c = CMPLX(re, im);
return c;
}

// strcat --------------------------------------------------------------------

LFORTRAN_API void _lfortran_strcat(char** s1, char** s2, char** dest)
Expand Down
1 change: 0 additions & 1 deletion src/libasr/runtime/lfortran_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ LFORTRAN_API float_complex_t _lfortran_catanh(float_complex_t x);
LFORTRAN_API double_complex_t _lfortran_zatanh(double_complex_t x);
LFORTRAN_API float _lfortran_cphase(float_complex_t x);
LFORTRAN_API double _lfortran_zphase(double_complex_t x);
LFORTRAN_API double_complex_t _lfortran_rect(double r, double phi);
LFORTRAN_API bool _lpython_str_compare_eq(char** s1, char** s2);
LFORTRAN_API bool _lpython_str_compare_noteq(char** s1, char** s2);
LFORTRAN_API bool _lpython_str_compare_gt(char** s1, char** s2);
Expand Down
8 changes: 5 additions & 3 deletions src/runtime/cmath.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from lpython import c64, ccall, f64, overload, c32, f32
from lpython_builtin import abs

pi: f64 = 3.141592653589793238462643383279502884197
e: f64 = 2.718281828459045235360287471352662497757
Expand Down Expand Up @@ -278,10 +277,13 @@ def polar(x: c32) -> tuple[f32, f32]:
def polar(x: c64) -> tuple[f64, f64]:
return (abs(x), phase(x))

@ccall
def _lfortran_dcos(x: f64) -> f64:
pass

@ccall
def _lfortran_rect(r: f64, phi: f64) -> c64:
def _lfortran_dsin(x: f64) -> f64:
pass

def rect(r: f64, phi: f64) -> c64:
return _lfortran_rect(r, phi)
return c64(complex(r*_lfortran_dcos(phi), r*_lfortran_dsin(phi)))

0 comments on commit 29737ad

Please sign in to comment.