RosettaCodeData/Task/Exponentiation-operator/Haskell/exponentiation-operator-2.hs

3 lines
104 B
Haskell

(^^) :: (Fractional a, Integral b) => a -> b -> a
x ^^ n = if n >= 0 then x^n else recip (x^(negate n))