X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FFloat.lhs;h=a353cc688cd53a2dfe8587195b4298b78e175ea6;hb=3aa288879627ae55480c919c1b23fb28ca09e536;hp=e0cc415e66616e61896cfd8aaedb7dc75289292e;hpb=a84ff424662be50dd8e704f0acc60222fc5c937c;p=ghc-base.git diff --git a/GHC/Float.lhs b/GHC/Float.lhs index e0cc415..a353cc6 100644 --- a/GHC/Float.lhs +++ b/GHC/Float.lhs @@ -785,11 +785,20 @@ expt base n = if base == 2 && n >= minExpt && n <= maxExpt then expts!n else - base^n + if base == 10 && n <= maxExpt10 then + expts10!n + else + base^n expts :: Array Int Integer expts = array (minExpt,maxExpt) [(n,2^n) | n <- [minExpt .. maxExpt]] +maxExpt10 :: Int +maxExpt10 = 324 + +expts10 :: Array Int Integer +expts10 = array (minExpt,maxExpt10) [(n,10^n) | n <- [minExpt .. maxExpt10]] + -- Compute the (floor of the) log of i in base b. -- Simplest way would be just divide i by b until it's smaller then b, but that would -- be very slow! We are just slightly more clever.