Skip to content

Commit 29737ad

Browse files
committed
Remove rect from lfortran_intrinsics.c
1 parent c74f00c commit 29737ad

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

src/libasr/runtime/lfortran_intrinsics.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -665,16 +665,6 @@ LFORTRAN_API double _lfortran_zphase(double_complex_t x)
665665
return atan2(cimag(x), creal(x));
666666
}
667667

668-
// rect --------------------------------------------------------------------
669-
670-
LFORTRAN_API double_complex_t _lfortran_rect(double r, double phi)
671-
{
672-
double re = r*cos(phi);
673-
double im = r*sin(phi);
674-
double complex c = CMPLX(re, im);
675-
return c;
676-
}
677-
678668
// strcat --------------------------------------------------------------------
679669

680670
LFORTRAN_API void _lfortran_strcat(char** s1, char** s2, char** dest)

src/libasr/runtime/lfortran_intrinsics.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ LFORTRAN_API float_complex_t _lfortran_catanh(float_complex_t x);
139139
LFORTRAN_API double_complex_t _lfortran_zatanh(double_complex_t x);
140140
LFORTRAN_API float _lfortran_cphase(float_complex_t x);
141141
LFORTRAN_API double _lfortran_zphase(double_complex_t x);
142-
LFORTRAN_API double_complex_t _lfortran_rect(double r, double phi);
143142
LFORTRAN_API bool _lpython_str_compare_eq(char** s1, char** s2);
144143
LFORTRAN_API bool _lpython_str_compare_noteq(char** s1, char** s2);
145144
LFORTRAN_API bool _lpython_str_compare_gt(char** s1, char** s2);

src/runtime/cmath.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from lpython import c64, ccall, f64, overload, c32, f32
2-
from lpython_builtin import abs
32

43
pi: f64 = 3.141592653589793238462643383279502884197
54
e: f64 = 2.718281828459045235360287471352662497757
@@ -278,10 +277,13 @@ def polar(x: c32) -> tuple[f32, f32]:
278277
def polar(x: c64) -> tuple[f64, f64]:
279278
return (abs(x), phase(x))
280279

280+
@ccall
281+
def _lfortran_dcos(x: f64) -> f64:
282+
pass
281283

282284
@ccall
283-
def _lfortran_rect(r: f64, phi: f64) -> c64:
285+
def _lfortran_dsin(x: f64) -> f64:
284286
pass
285287

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

0 commit comments

Comments
 (0)