@@ -20,9 +20,6 @@ nanmath_st.rewrites[:nanmath] = true
2020 @test toexpr (a* b* c* d* e) == :($ (* )($ (* )($ (* )($ (* )(a, b), c), d), e))
2121 @test toexpr (a+ b+ c+ d+ e) == :($ (+ )($ (+ )($ (+ )($ (+ )(a, b), c), d), e))
2222 @test toexpr (a+ b) == :($ (+ )(a, b))
23- @test toexpr (a^ b) == :($ (^ )(a, b))
24- @test toexpr (a^ 2 ) == :($ (^ )(a, 2 ))
25- @test toexpr (a^- 2 ) == :($ (/ )(1 , $ (^ )(a, 2 )))
2623 @test toexpr (x (t)+ y (t)) == :($ (+ )(x (t), y (t)))
2724 @test toexpr (x (t)+ y (t)+ x (t+ 1 )) == :($ (+ )($ (+ )(x (t), y (t)), x ($ (+ )(1 , t))))
2825 s = LazyState ()
@@ -87,8 +84,35 @@ nanmath_st.rewrites[:nanmath] = true
8784 end )
8885 @test toexpr (SetArray (true , a, [x (t), AtIndex (9 , b), c])). head == :macrocall
8986
87+ for fname in (:sin , :cos , :tan , :asin , :acos , :acosh , :atanh , :log , :log2 , :log10 , :log1p , :sqrt )
88+ f = getproperty (Base, fname)
89+ @test toexpr (f (a)) == :($ f (a))
90+ @test toexpr (f (a), nanmath_st) == :($ (GlobalRef (NaNMath, fname))(a))
9091
92+ nanmath_f = getproperty (NaNMath, fname)
93+ @test toexpr (nanmath_f (a)) == :($ nanmath_f (a))
94+ @test toexpr (nanmath_f (a), nanmath_st) == :($ nanmath_f (a))
95+ end
96+
97+ @test toexpr (a^ b) == :($ (^ )(a, b))
98+ @test toexpr (a^ b, nanmath_st) == :($ (NaNMath. pow)(a, b))
9199 @test toexpr (NaNMath. pow (a, b)) == :($ (NaNMath. pow)(a, b))
100+ @test toexpr (NaNMath. pow (a, b), nanmath_st) == :($ (NaNMath. pow)(a, b))
101+
102+ @test toexpr (a^ 2 ) == :($ (^ )(a, 2 ))
103+ @test toexpr (a^ 2 , nanmath_st) == :($ (NaNMath. pow)(a, 2 ))
104+ @test toexpr (NaNMath. pow (a, 2 )) == :($ (NaNMath. pow)(a, 2 ))
105+ @test toexpr (NaNMath. pow (a, 2 ), nanmath_st) == :($ (NaNMath. pow)(a, 2 ))
106+
107+ @test toexpr (a^- 1 ) == :($ (/ )(1 , a))
108+ @test toexpr (a^- 1 , nanmath_st) == :($ (/ )(1 , a))
109+ @test toexpr (NaNMath. pow (a, - 1 )) == :($ (NaNMath. pow)(a, - 1 ))
110+ @test toexpr (NaNMath. pow (a, - 1 ), nanmath_st) == :($ (NaNMath. pow)(a, - 1 ))
111+
112+ @test toexpr (a^- 2 ) == :($ (/ )(1 , $ (^ )(a, 2 )))
113+ @test toexpr (a^- 2 , nanmath_st) == :($ (/ )(1 , $ (NaNMath. pow)(a, 2 )))
114+ @test toexpr (NaNMath. pow (a, - 2 )) == :($ (NaNMath. pow)(a, - 2 ))
115+ @test toexpr (NaNMath. pow (a, - 2 ), nanmath_st) == :($ (NaNMath. pow)(a, - 2 ))
92116
93117 f = GlobalRef (NaNMath, :sin )
94118 test_repr (toexpr (LiteralExpr (:(let x= 1 , y= 2
0 commit comments