Skip to content

Commit

Permalink
add ^ for integer powers
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoms committed Sep 21, 2024
1 parent ae4bd94 commit cc46ce6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/MultiFloats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,13 @@ end

# TODO: MultiFloat-Int arithmetic operators.

function Base.:(^)(x::_MF{T,N}, p::Integer) where {T,N}
if p >= 0
Base.power_by_squaring(x,p)
else
Base.power_by_squaring(inv(x),-p)
end
end

########################################################### ARITHMETIC OVERLOADS

Expand Down

0 comments on commit cc46ce6

Please sign in to comment.