From cc46ce683df74eaf41ff0bcf7cf5e8a7b53f83c1 Mon Sep 17 00:00:00 2001 From: araujoms Date: Sat, 21 Sep 2024 22:16:24 +0200 Subject: [PATCH] add ^ for integer powers --- src/MultiFloats.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/MultiFloats.jl b/src/MultiFloats.jl index 8e075c6..258897a 100644 --- a/src/MultiFloats.jl +++ b/src/MultiFloats.jl @@ -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