diff --git a/src/dual.jl b/src/dual.jl index 687b8a35..d4e99b44 100644 --- a/src/dual.jl +++ b/src/dual.jl @@ -609,6 +609,16 @@ end return (Dual{T}(sd, cd * partials(d)), Dual{T}(cd, -sd * partials(d))) end +# sincospi # +#----------# + +if VERSION >= v"1.6.0-DEV.292" + @inline function Base.sincospi(d::Dual{T}) where T + sd, cd = sincospi(value(d)) + return (Dual{T}(sd, cd * π * partials(d)), Dual{T}(cd, -sd * π * partials(d))) + end +end + ################### # Pretty Printing # ################### diff --git a/test/DualTest.jl b/test/DualTest.jl index dec58c1f..4e8ac909 100644 --- a/test/DualTest.jl +++ b/test/DualTest.jl @@ -449,6 +449,10 @@ for N in (0,3), M in (0,4), V in (Int, Float32) @test all(map(dual_isapprox, ForwardDiff.sincos(FDNUM), (sin(FDNUM), cos(FDNUM)))) + if VERSION >= v"1.6.0-DEV.292" + @test all(map(dual_isapprox, sincospi(FDNUM), (sinpi(FDNUM), cospi(FDNUM)))) + end + if V === Float32 @test typeof(sqrt(FDNUM)) === typeof(FDNUM) @test typeof(sqrt(NESTED_FDNUM)) === typeof(NESTED_FDNUM)