Skip to content

Commit 2ae4640

Browse files
authored
Merge pull request #2143 from certik/pi_fix
Remove global variables
2 parents a2715e6 + e830b0f commit 2ae4640

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/runtime/lpython_intrinsic_numpy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
from lpython import i32, i64, f64, f32, ccall, vectorize, overload
22

3-
pi_64: f64 = f64(3.141592653589793238462643383279502884197)
4-
pi_32: f32 = f32(3.141592653589793238462643383279502884197)
5-
63
########## sin ##########
74

85
@ccall
@@ -274,23 +271,27 @@ def arctan(x: f32) -> f32:
274271
@overload
275272
@vectorize
276273
def degrees(x: f64) -> f64:
274+
pi_64: Const[f64] = f64(3.141592653589793238462643383279502884197)
277275
return x*180.0/pi_64
278276

279277
@overload
280278
@vectorize
281279
def degrees(x: f32) -> f32:
280+
pi_32: Const[f32] = f32(3.141592653589793238462643383279502884197)
282281
return x*f32(f32(180)/pi_32)
283282

284283
########## radians ##########
285284

286285
@overload
287286
@vectorize
288287
def radians(x: f64) -> f64:
288+
pi_64: Const[f64] = f64(3.141592653589793238462643383279502884197)
289289
return x*pi_64/180.0
290290

291291
@overload
292292
@vectorize
293293
def radians(x: f32) -> f32:
294+
pi_32: Const[f32] = f32(3.141592653589793238462643383279502884197)
294295
return x*f32(pi_32/f32(180))
295296

296297
########## arcsinh ##########

tests/reference/c-bindc_06-a30d20f.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "c-bindc_06-a30d20f.stdout",
9-
"stdout_hash": "6a93f686a1c2fe616c5de50dd3e339f5db7d226f48b29e5569412402",
9+
"stdout_hash": "7fdf946af48e4b286aa2a5a328ed8edb8e50b98c252f7290f273d1a0",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/c-bindc_06-a30d20f.stdout

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ float _lfortran_caimag(float complex x);
8181

8282
double _lfortran_zaimag(double complex x);
8383

84-
float pi_32 = 3.14159265358979312e+00;
85-
double pi_64 = 3.14159265358979312e+00;
8684
double _lfortran_dacos(double x);
8785

8886
double _lfortran_dacosh(double x);

0 commit comments

Comments
 (0)