Skip to content

Commit

Permalink
Merge 103414a into 958711d
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Feb 22, 2019
2 parents 958711d + 103414a commit 9fe389f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/dual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ end
if S T
d
else
throw(DualMismatchError(T,S))
throw(DualMismatchError(T,S))
end
end

Expand Down Expand Up @@ -360,6 +360,8 @@ Base.convert(::Type{D}, d::D) where {D<:Dual} = d
Base.float(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)
Base.AbstractFloat(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)

Base.Integer(x::Dual) = Integer(value(x))

###################################
# General Mathematical Operations #
###################################
Expand Down
7 changes: 7 additions & 0 deletions test/DualTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,11 @@ end
@test pow(x1, 0) === x1^0 === Dual{:t1}(1.0, 0.0)
end

@testset "Duals with ranges" begin
t = ForwardDiff.Dual.((0.0,10.0),0)
r = (t[1]:1/60:t[2])
@test r[1] == t[1]
@test r[end] == t[2]
end

end # module

0 comments on commit 9fe389f

Please sign in to comment.