Skip to content

Commit 3ca3fc9

Browse files
committed
move to be with other floating operations
1 parent 1f5e4fa commit 3ca3fc9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/dual.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,6 @@ end
314314
Integer(value(d))
315315
end
316316

317-
for F in (:Float16, :Float32, :Float64)
318-
@eval @inline Base.$F(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, $F),N}, d)
319-
end
320-
321317
@inline Random.rand(rng::AbstractRNG, d::Dual) = rand(rng, value(d))
322318
@inline Random.rand(::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(rand(V), zero(Partials{N,V}))
323319
@inline Random.rand(rng::AbstractRNG, ::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(rand(rng, V), zero(Partials{N,V}))
@@ -387,6 +383,10 @@ Base.convert(::Type{D}, d::D) where {D<:Dual} = d
387383
Base.float(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)
388384
Base.AbstractFloat(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)
389385

386+
for F in (:Float16, :Float32, :Float64)
387+
@eval @inline Base.$F(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, $F),N}, d)
388+
end
389+
390390
###################################
391391
# General Mathematical Operations #
392392
###################################

0 commit comments

Comments
 (0)