File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
import math
2
2
import numpy as np
3
+ import sys
3
4
import typing
4
5
from functools import lru_cache
5
6
@@ -363,7 +364,10 @@ def comp(x: ts["T"]):
363
364
log2 = define_unary_op ("log2" , lambda x : math .log2 (x ))
364
365
log10 = define_unary_op ("log10" , lambda x : math .log10 (x ))
365
366
exp = define_unary_op ("exp" , lambda x : math .exp (x ))
366
- exp2 = define_unary_op ("exp2" , lambda x : math .exp2 (x ))
367
+ if sys .version_info < (3 , 11 ):
368
+ exp2 = define_unary_op ("exp2" , lambda x : 2 ** x )
369
+ else :
370
+ exp2 = define_unary_op ("exp2" , lambda x : math .exp2 )
367
371
sqrt = define_unary_op ("sqrt" , lambda x : math .sqrt (x ))
368
372
erf = define_unary_op ("erf" , lambda x : math .erf (x ))
369
373
sin = define_unary_op ("sin" , lambda x : math .sin (x ))
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ def test_math_unary_ops(self):
122
122
csp .log2 : lambda x : math .log2 (x ),
123
123
csp .log10 : lambda x : math .log10 (x ),
124
124
csp .exp : lambda x : math .exp (x ),
125
- csp .exp2 : lambda x : math . exp2 ( x ) ,
125
+ csp .exp2 : lambda x : 2 ** x ,
126
126
csp .sin : lambda x : math .sin (x ),
127
127
csp .cos : lambda x : math .cos (x ),
128
128
csp .tan : lambda x : math .tan (x ),
You can’t perform that action at this time.
0 commit comments