File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import math
22import numpy as np
3+ import sys
34import typing
45from functools import lru_cache
56
@@ -363,7 +364,10 @@ def comp(x: ts["T"]):
363364log2 = define_unary_op ("log2" , lambda x : math .log2 (x ))
364365log10 = define_unary_op ("log10" , lambda x : math .log10 (x ))
365366exp = 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 )
367371sqrt = define_unary_op ("sqrt" , lambda x : math .sqrt (x ))
368372erf = define_unary_op ("erf" , lambda x : math .erf (x ))
369373sin = 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):
122122 csp .log2 : lambda x : math .log2 (x ),
123123 csp .log10 : lambda x : math .log10 (x ),
124124 csp .exp : lambda x : math .exp (x ),
125- csp .exp2 : lambda x : math . exp2 ( x ) ,
125+ csp .exp2 : lambda x : 2 ** x ,
126126 csp .sin : lambda x : math .sin (x ),
127127 csp .cos : lambda x : math .cos (x ),
128128 csp .tan : lambda x : math .tan (x ),
You can’t perform that action at this time.
0 commit comments