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

3 lines
104 B
Haskell
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
(^^) :: (Fractional a, Integral b) => a -> b -> a
x ^^ n = if n >= 0 then x^n else recip (x^(negate n))