Skip to content

Commit

Permalink
Fix issue #39
Browse files Browse the repository at this point in the history
  • Loading branch information
briochemc authored May 24, 2022
1 parent 66065e9 commit 8385e71
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "HyperDualNumbers"
uuid = "50ceba7f-c3ee-5a84-a6e8-3ad40456ec97"
authors = ["Rob J Goedman <[email protected]>"]
version = "4.0.8"
version = "4.0.9"

[deps]
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
Expand Down
1 change: 1 addition & 0 deletions src/hyperdual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ struct Hyper{T<:ReComp} <: Number
end
Hyper(x::S, y::T, z::U, w::V) where {S<:ReComp,T<:ReComp,U<:ReComp,V<:ReComp} = Hyper(promote(x,y,z,w)...)
Hyper(x::ReComp) = Hyper(x, zero(x), zero(x), zero(x))
Hyper{T}(x::ReComp) where T<:ReComp = Hyper{T}(T(x), zero(T), zero(T), zero(T))

"""
Creation of a HyperDualNumber
Expand Down
2 changes: 2 additions & 0 deletions test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ hd9 = hyper(-1.0, -2.0, -3.0, -4.0)

hdNaN = hyper(0/0)

hd_from_f32 = Hyper{Float64}(1f2)

# Addition and subtraction
@test ε₁part(hd1) == 0.0
@test isequal(hd1 + hd2, hyper(2.0, 2.0, 3.0, 4.0))
Expand Down

0 comments on commit 8385e71

Please sign in to comment.