We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d658b88 + 0a34059 commit 7816c14Copy full SHA for 7816c14
1 file changed
Statistics/Sample.hs
@@ -1,4 +1,5 @@
1
{-# LANGUAGE FlexibleContexts #-}
2
+{-# LANGUAGE BangPatterns #-}
3
-- |
4
-- Module : Statistics.Sample
5
-- Copyright : (c) 2008 Don Stewart, 2009 Bryan O'Sullivan
@@ -452,8 +453,9 @@ pair va vb
452
453
454
-- (^) operator from Prelude is just slow.
455
(^) :: Double -> Int -> Double
-x ^ 1 = x
456
-x ^ n = x * (x ^ (n-1))
+x0 ^ n0 = go (n0-1) x0 where
457
+ go 0 !acc = acc
458
+ go n acc = go (n-1) (acc*x0)
459
{-# INLINE (^) #-}
460
461
-- don't support polymorphism, as we can't get unboxed returns if we use it.
0 commit comments