You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/EltypeExtensions.jl
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -116,9 +116,12 @@ _to_precisiontype(::Type{T}, ::Type{<:Rational}) where T<:Integer = Rational{T}
116
116
_to_precisiontype(::Type{T}, ::Type{S}) where {T,S} =eltype(S) == S ? T :_to_eltype(_to_precisiontype(T, eltype(S)), S)
117
117
118
118
"""
119
-
precisionconvert(T::Type, A, prec=precision(T))
119
+
precisionconvert(T::Type, A, prec)
120
120
121
-
Convert `A` to have the [`precisiontype`](@ref) of `T`. If `T` has adjustable precision such as `BigFloat`, the precision can be specified by `prec`, otherwise `prec` takes no effect.
121
+
Convert `A` to have the [`precisiontype`](@ref) of `T`. `prec` is optional.
122
+
- When `T` has static precision (e.g. `Float64`), `prec` has no effect.
123
+
- When `T` has dynamic precision (e.g. `BigFloat`), `prec` specifies the precision of conversion. When `prec` is not provided, the precision is decided by the external setup from `T`.
124
+
- When `T` is an integer, the conversion will dig into `Rational` as well. In contrast, since `Rational` as a whole is more "precise" than an integer, [`precisiontype`](@ref) doesn't unwrap `Rational`.
0 commit comments