@@ -28,14 +28,11 @@ const ∞ = Infinity()
2828show (io:: IO , :: Infinity ) = print (io, " ∞" )
2929string (:: Infinity ) = " ∞"
3030
31- convert (:: Type{Float64} , :: Infinity ) = Inf64
32- convert (:: Type{Float32} , :: Infinity ) = Inf32
33- convert (:: Type{Float16} , :: Infinity ) = Inf16
34- Base. Float64 (:: Infinity ) = convert (Float64, ∞)
35- Base. Float32 (:: Infinity ) = convert (Float32, ∞)
36- Base. Float16 (:: Infinity ) = convert (Float16, ∞)
37- Base. BigFloat (:: Infinity ) = BigFloat (Inf )
38- convert (:: Type{AF} , :: Infinity ) where AF<: AbstractFloat = convert (AF, Inf )
31+ _convert (:: Type{Float64} , :: Infinity ) = Inf64
32+ _convert (:: Type{Float32} , :: Infinity ) = Inf32
33+ _convert (:: Type{Float16} , :: Infinity ) = Inf16
34+ _convert (:: Type{T} , :: Infinity ) where {T<: Real } = convert (T, Inf ):: T
35+ (:: Type{T} )(x:: Infinity ) where {T<: Real } = _convert (T, x)
3936
4037
4138sign (y:: Infinity ) = 1
@@ -131,16 +128,13 @@ isinf(::RealInfinity) = true
131128isfinite (:: RealInfinity ) = false
132129
133130promote_rule (:: Type{Infinity} , :: Type{RealInfinity} ) = RealInfinity
134- convert (:: Type{RealInfinity} , :: Infinity ) = RealInfinity (false )
135-
136- convert (:: Type{Float64} , x:: RealInfinity ) = sign (x)* Inf64
137- convert (:: Type{Float32} , x:: RealInfinity ) = sign (x)* Inf32
138- convert (:: Type{Float16} , x:: RealInfinity ) = sign (x)* Inf16
139- Base. Float64 (x:: RealInfinity ) = convert (Float64, x)
140- Base. Float32 (x:: RealInfinity ) = convert (Float32, x)
141- Base. Float16 (x:: RealInfinity ) = convert (Float16, x)
142- Base. BigFloat (x:: RealInfinity ) = sign (x)* BigFloat (Inf )
143- convert (:: Type{AF} , x:: RealInfinity ) where AF<: AbstractFloat = sign (x)* convert (AF, Inf )
131+ _convert (:: Type{RealInfinity} , :: Infinity ) = RealInfinity (false )
132+
133+ _convert (:: Type{Float16} , x:: RealInfinity ) = sign (x)* Inf16
134+ _convert (:: Type{Float32} , x:: RealInfinity ) = sign (x)* Inf32
135+ _convert (:: Type{Float64} , x:: RealInfinity ) = sign (x)* Inf64
136+ _convert (:: Type{T} , x:: RealInfinity ) where {T<: Real } = sign (x)* convert (T, Inf )
137+ (:: Type{T} )(x:: RealInfinity ) where {T<: Real } = _convert (T, x)
144138
145139
146140signbit (y:: RealInfinity ) = y. signbit
0 commit comments