diff --git a/Project.toml b/Project.toml index 6053b3f2..ba20df67 100644 --- a/Project.toml +++ b/Project.toml @@ -4,7 +4,7 @@ repo = "https://github.com/JeffreySarnoff/ArbNumerics.jl.git" keywords = ["math", "floating-point", "extended-precision", "accuracy", "precision"] author = "Jeffrey Sarnoff" license = "MIT" -version = "v1.5.1" +version = "v1.5.2" [deps] Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" diff --git a/src/libarb/promote.jl b/src/libarb/promote.jl index 2c4caf6a..e736a98b 100644 --- a/src/libarb/promote.jl +++ b/src/libarb/promote.jl @@ -1,68 +1,68 @@ for T in (:Int8, :Int16, :Int32, :Int64, :Int128, :Float16, :Float32, :Float64) @eval begin - promote_rule(::Type{ArbComplex}, ::Type{$T}) = ArbComplex - promote_rule(::Type{ArbReal}, ::Type{$T}) = ArbReal - promote_rule(::Type{ArbFloat}, ::Type{$T}) = ArbFloat + promote_type(::Type{ArbComplex}, ::Type{$T}) = ArbComplex + promote_type(::Type{ArbReal}, ::Type{$T}) = ArbReal + promote_type(::Type{ArbFloat}, ::Type{$T}) = ArbFloat - promote_rule(::Type{ArbComplex{P}}, ::Type{$T}) where {P} = ArbComplex{P} - promote_rule(::Type{ArbReal{P}}, ::Type{$T}) where {P} = ArbReal{P} - promote_rule(::Type{ArbFloat{P}}, ::Type{$T}) where {P} = ArbFloat{P} + promote_type(::Type{ArbComplex{P}}, ::Type{$T}) where {P} = ArbComplex{P} + promote_type(::Type{ArbReal{P}}, ::Type{$T}) where {P} = ArbReal{P} + promote_type(::Type{ArbFloat{P}}, ::Type{$T}) where {P} = ArbFloat{P} end end -promote_rule(::Type{ArbComplex}, ::Type{ArbReal}) = ArbComplex -promote_rule(::Type{ArbComplex}, ::Type{ArbFloat}) = ArbComplex -promote_rule(::Type{ArbReal}, ::Type{ArbFloat}) = ArbReal +promote_type(::Type{ArbComplex}, ::Type{ArbReal}) = ArbComplex +promote_type(::Type{ArbComplex}, ::Type{ArbFloat}) = ArbComplex +promote_type(::Type{ArbReal}, ::Type{ArbFloat}) = ArbReal -promote_rule(::Type{ArbComplex{P}}, ::Type{ArbReal{P}}) where {P} = ArbComplex{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{ArbFloat{P}}) where {P} = ArbComplex{P} -promote_rule(::Type{ArbReal{P}}, ::Type{ArbFloat{P}}) where {P} = ArbReal{P} +promote_type(::Type{ArbComplex{P}}, ::Type{ArbReal{P}}) where {P} = ArbComplex{P} +promote_type(::Type{ArbComplex{P}}, ::Type{ArbFloat{P}}) where {P} = ArbComplex{P} +promote_type(::Type{ArbReal{P}}, ::Type{ArbFloat{P}}) where {P} = ArbReal{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{Mag}) where {P} = ArbComplex{P} -promote_rule(::Type{ArbReal{P}}, ::Type{Mag}) where {P} = ArbReal{P} -promote_rule(::Type{ArbFloat{P}}, ::Type{Mag}) where {P} = ArbFloat{P} +promote_type(::Type{ArbComplex{P}}, ::Type{Mag}) where {P} = ArbComplex{P} +promote_type(::Type{ArbReal{P}}, ::Type{Mag}) where {P} = ArbReal{P} +promote_type(::Type{ArbFloat{P}}, ::Type{Mag}) where {P} = ArbFloat{P} -promote_rule(::Type{ArbFloat{P}}, ::Type{BigInt}) where {P} = ArbFloat{P} -promote_rule(::Type{ArbReal{P}}, ::Type{BigInt}) where {P} = ArbReal{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{BigInt}) where {P} = ArbComplex{P} +promote_type(::Type{ArbFloat{P}}, ::Type{BigInt}) where {P} = ArbFloat{P} +promote_type(::Type{ArbReal{P}}, ::Type{BigInt}) where {P} = ArbReal{P} +promote_type(::Type{ArbComplex{P}}, ::Type{BigInt}) where {P} = ArbComplex{P} -promote_rule(::Type{ArbFloat{P}}, ::Type{Rational{I}}) where {P,I} = ArbFloat{P} -promote_rule(::Type{ArbReal{P}}, ::Type{Rational{I}}) where {P,I} = ArbReal{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{Rational{I}}) where {P,I} = ArbComplex{P} +promote_type(::Type{ArbFloat{P}}, ::Type{Rational{I}}) where {P,I} = ArbFloat{P} +promote_type(::Type{ArbReal{P}}, ::Type{Rational{I}}) where {P,I} = ArbReal{P} +promote_type(::Type{ArbComplex{P}}, ::Type{Rational{I}}) where {P,I} = ArbComplex{P} -promote_rule(::Type{ArbFloat{P}}, ::Type{BigFloat}) where {P} = ArbFloat{P} -promote_rule(::Type{ArbReal{P}}, ::Type{BigFloat}) where {P} = ArbReal{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{BigFloat}) where {P} = ArbComplex{P} +promote_type(::Type{ArbFloat{P}}, ::Type{BigFloat}) where {P} = ArbFloat{P} +promote_type(::Type{ArbReal{P}}, ::Type{BigFloat}) where {P} = ArbReal{P} +promote_type(::Type{ArbComplex{P}}, ::Type{BigFloat}) where {P} = ArbComplex{P} -promote_rule(::Type{ArbFloat{P}}, ::Type{I}) where {P, I<:Integer} = ArbFloat{P} -promote_rule(::Type{ArbReal{P}}, ::Type{I}) where {P, I<:Integer} = ArbReal{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{I}) where {P, I<:Integer} = ArbComplex{P} +promote_type(::Type{ArbFloat{P}}, ::Type{I}) where {P, I<:Integer} = ArbFloat{P} +promote_type(::Type{ArbReal{P}}, ::Type{I}) where {P, I<:Integer} = ArbReal{P} +promote_type(::Type{ArbComplex{P}}, ::Type{I}) where {P, I<:Integer} = ArbComplex{P} -promote_rule(::Type{ArbFloat{P}}, ::Type{F}) where {P, F<:AbstractFloat} = ArbFloat{P} -promote_rule(::Type{ArbReal{P}}, ::Type{F}) where {P, F<:AbstractFloat} = ArbReal{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{F}) where {P, F<:AbstractFloat} = ArbComplex{P} -promote_rule(::Type{ArbComplex{P}}, ::Type{C}) where {P, C<:Complex} = ArbComplex{P} +promote_type(::Type{ArbFloat{P}}, ::Type{F}) where {P, F<:AbstractFloat} = ArbFloat{P} +promote_type(::Type{ArbReal{P}}, ::Type{F}) where {P, F<:AbstractFloat} = ArbReal{P} +promote_type(::Type{ArbComplex{P}}, ::Type{F}) where {P, F<:AbstractFloat} = ArbComplex{P} +promote_type(::Type{ArbComplex{P}}, ::Type{C}) where {P, C<:Complex} = ArbComplex{P} -promote_rule(::Type{ArbFloat{P}}, x::ArbFloat{Q}) where {P,Q} = +promote_type(::Type{ArbFloat{P}}, x::ArbFloat{Q}) where {P,Q} = P>Q ? ArbFloat{P} : ArbFloat{Q} -promote_rule(::Type{ArbReal{P}}, x::ArbReal{Q}) where {P,Q} = +promote_type(::Type{ArbReal{P}}, x::ArbReal{Q}) where {P,Q} = P>Q ? ArbReal{P} : ArbReal{Q} -promote_rule(::Type{ArbComplex{P}}, x::ArbComplex{Q}) where {P,Q} = +promote_type(::Type{ArbComplex{P}}, x::ArbComplex{Q}) where {P,Q} = P>Q ? ArbComplex{P} : ArbComplex{Q} -promote_rule(::Type{ArbFloat{P}}, x::ArbReal{Q}) where {P,Q} = +promote_type(::Type{ArbFloat{P}}, x::ArbReal{Q}) where {P,Q} = P>Q ? ArbReal{P} : ArbReal{Q} -promote_rule(::Type{ArbFloat{P}}, x::ArbComplex{Q}) where {P,Q} = +promote_type(::Type{ArbFloat{P}}, x::ArbComplex{Q}) where {P,Q} = P>Q ? ArbComplex{P} : ArbComplex{Q} -promote_rule(::Type{ArbReal{P}}, x::ArbComplex{Q}) where {P,Q} = +promote_type(::Type{ArbReal{P}}, x::ArbComplex{Q}) where {P,Q} = P>Q ? ArbComplex{P} : ArbComplex{Q} -promote_rule(::Type{ArbFloat{P}},::Type{ArbFloat{Q}}) where {P,Q} = P