packages feed

primesieve 0.1.0.0 → 0.1.0.1

raw patch · 2 files changed

+37/−3 lines, 2 filesnew-component:exe:prime-count

Files

+ example/Count.hs view
@@ -0,0 +1,23 @@+import Foundation++import Math.Prime.FastSieve++-- Test the results of prime count.++testEq :: (Eq a, Show a) => String -> a -> a -> IO ()+testEq message a b = do+    putStr $ message <> show a+    if a /= b+        then putStrLn $ ", but should be: " <> show b+        else putStrLn ""++main :: IO ()+main = do+    putStrLn "Test count of prime numbers"++    testEq "count within 10^8: " (countPrimes 0 100000000) 5761455+    testEq "count within 10^9: " (countPrimes 0 1000000000) 50847534+    testEq "count within 2^32: " (countPrimes 0 4294967296) 203280221+    testEq "count within 10^10: " (countPrimes 0 10000000000) 455052511+    testEq "count within 10^11: " (countPrimes 0 100000000000) 4118054813+
primesieve.cabal view
@@ -1,11 +1,11 @@ name:                primesieve-version:             0.1.0.0+version:             0.1.0.1 synopsis:            FFI bindings for the primesieve library. description:         FFI bindings for the primesieve library. homepage:            https://github.com/sighingnow/computations/tree/master/primesieve#readme-author:              Tao He+author:              HE, Tao maintainer:          sighingnow@gmail.com-copyright:           Copyright: (c) 2017 Tao He+copyright:           Copyright: (c) 2017 HE, Tao category:            Algorithms, Foreign, Math, Number Theory build-type:          Simple cabal-version:       >=1.10@@ -24,6 +24,17 @@                      , OverloadedStrings   build-depends:       base >= 4.7 && < 5                      , foundation++executable prime-count+  hs-source-dirs:      example+  main-is:             Count.hs+  default-language:    Haskell2010+  default-extensions:  NoImplicitPrelude+                     , OverloadedStrings+  build-depends:       base >= 4.7 && < 5+                     , foundation+                     , primesieve+  extra-libraries:     primesieve  executable prime-example   hs-source-dirs:      example