diff --git a/src/primitive.jl b/src/primitive.jl index 0e21b4a..caff022 100644 --- a/src/primitive.jl +++ b/src/primitive.jl @@ -5,8 +5,18 @@ import Base: asin, acos, atan, acot, asec, acsc, asinh, acosh, atanh, acoth, ase import Base: sinc, cosc import Base: +, -, *, /, \, ^, >, <, >=, <=, == import Base: hypot, max, min +import Base: tail # Unary +@inline +(a::Number, b::TaylorScalar) = TaylorScalar((a + value(b)[1]), tail(value(b))...) +@inline -(a::Number, b::TaylorScalar) = TaylorScalar((a - value(b)[1]), .-tail(value(b))...) +@inline *(a::Number, b::TaylorScalar) = TaylorScalar((a .* value(b))...) +@inline /(a::Number, b::TaylorScalar) = /(promote(a, b)...) + +@inline +(a::TaylorScalar, b::Number) = TaylorScalar((value(a)[1] + b), tail(value(a))...) +@inline -(a::TaylorScalar, b::Number) = TaylorScalar((value(a)[1] - b), tail(value(a))...) +@inline *(a::TaylorScalar, b::Number) = TaylorScalar((value(a) .* b)...) +@inline /(a::TaylorScalar, b::Number) = TaylorScalar((value(a) ./ b)...) ## Delegated