Skip to content

Commit

Permalink
sinpi, cospi
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujch1 committed Sep 27, 2023
1 parent 32a41f1 commit 87a3dba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/primitive.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Base: abs, abs2
import Base: exp, exp2, exp10, expm1, log, log2, log10, log1p, inv, sqrt, cbrt
import Base: sin, cos, tan, cot, sec, csc, sinh, cosh, tanh, coth, sech, csch
import Base: sin, cos, tan, cot, sec, csc, sinh, cosh, tanh, coth, sech, csch, sinpi, cospi
import Base: asin, acos, atan, acot, asec, acsc, asinh, acosh, atanh, acoth, asech, acsch
import Base: sinc, cosc
import Base: +, -, *, /, \, ^, >, <, >=, <=, ==
Expand Down Expand Up @@ -69,6 +69,9 @@ for func in (:sin, :cos)
end
end

@inline sinpi(t::TaylorScalar) = sin* t)
@inline cospi(t::TaylorScalar) = cos* t)

# Binary

for op in [:>, :<, :(==), :(>=), :(<=)]
Expand Down
3 changes: 2 additions & 1 deletion test/primitive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ end

@testset "Unary functions" begin
some_number = 3.7
for f in (x -> exp(x^2), expm1, exp2, exp10, x -> sin(x^2), x -> cos(x^2), sqrt, cbrt,
for f in (x -> exp(x^2), expm1, exp2, exp10, x -> sin(x^2), x -> cos(x^2), sinpi, cospi,
sqrt, cbrt,
inv), order in (1, 4)
fdm = central_fdm(12, order)
@test derivative(f, some_number, order)fdm(f, some_number) rtol=1e-6
Expand Down

0 comments on commit 87a3dba

Please sign in to comment.