Skip to content

Commit

Permalink
add generic renormalize and complex constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhang314 committed Sep 8, 2024
1 parent 8b096c6 commit c054c9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/MultiFloats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ end
_MF{T,N}(renormalize(x._limbs))
@inline renormalize(x::_MFV{M,T,N}) where {M,T,N} =
_MFV{M,T,N}(renormalize(x._limbs))
@inline renormalize(x::T) where {T<:Real} = x


################################################### FLOATING-POINT INTROSPECTION
Expand Down Expand Up @@ -857,6 +858,11 @@ import Printf: tofloat
@inline tofloat(x::_MF{T,N}) where {T,N} = _call_big(BigFloat, x)


@inline MultiFloat{T,N}(z::Complex) where {T,N} =
isreal(z) ? MultiFloat{T,N}(real(z)) :
throw(InexactError(nameof(MultiFloat{T,N}), MultiFloat{T,N}, z))


##################################################################### COMPARISON


Expand Down

0 comments on commit c054c9e

Please sign in to comment.