fast-arithmetic 0.1.1.3 → 0.1.1.4
raw patch · 12 files changed
+173/−159 lines, 12 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Numeric.Combinatorics: doubleFactorial :: Int -> IO Integer
+ Numeric.NumberTheory: sumDivisors :: Int -> Int
+ Numeric.Pure: hsSumDivisors :: (Integral a) => a -> a
Files
- ats-src/combinatorics-ffi.dats +2/−2
- ats-src/number-theory-ffi.dats +3/−3
- ats-src/number-theory.dats +0/−2
- bench/Bench.hs +4/−0
- cbits/combinatorics.c +18/−18
- cbits/number-theory.c +123/−123
- cbits/numerics.c +1/−1
- fast-arithmetic.cabal +2/−2
- src/Numeric/Combinatorics.hs +6/−0
- src/Numeric/NumberTheory.hs +6/−0
- src/Numeric/Pure.hs +1/−1
- test/Spec.hs +7/−7
ats-src/combinatorics-ffi.dats view
@@ -18,7 +18,7 @@ "mac#" extern-fun double_factorial {n : nat} : int(n) -> Intinf =+fun double_factorial_ats {n : nat} : int(n) -> Intinf = "mac#" extern@@ -31,7 +31,7 @@ implement permutations_ats (n, k) = choose(n, k) -implement double_factorial (m) =+implement double_factorial_ats (m) = dfact(m) implement factorial_ats (m) =
ats-src/number-theory-ffi.dats view
@@ -16,15 +16,15 @@ "mac#" extern-fun gcd_ats : {n : nat} {m : nat} (int(m), int(n)) -> int =+fun sum_divisors_ats : { n : nat | n >= 1 } int(n) -> int = "mac#" extern fun is_perfect_ats : intGte(1) -> bool = "mac#" -implement gcd_ats (m, n) =- gcd(m, n)+implement sum_divisors_ats (m) =+ sum_divisors(m) implement count_divisors_ats (n) = count_divisors(n)
ats-src/number-theory.dats view
@@ -56,7 +56,6 @@ loop(n, 1) end -// FIXME this should return an Intinf fn sum_divisors(n : intGte(1)) :<> int = let fun loop {k : nat}{ m : nat | m > 0 && k >= m } .<k-m>. (n : int(k), acc : int(m)) :<> int =@@ -71,7 +70,6 @@ loop(n, 1) end -// TODO proofs of correctness like HX for fibonacci numbers? fn is_perfect(n : intGte(1)) :<> bool = sum_divisors(n) = n
bench/Bench.hs view
@@ -32,6 +32,10 @@ [ bench "factorial" $ nfIO (factorial 1000) , bench "hsFactorial" $ nf hsFactorial (1000 :: Integer) ]+ , bgroup "doubleFactorial"+ [ bench "doubleFactorial" $ nfIO (doubleFactorial 79)+ , bench "hsDoubleFactorial" $ nf hsDoubleFactorial (79 :: Integer)+ ] , bgroup "choose" [ bench "choose" $ nfIO (choose 322 16) , bench "hsChoose" $ nf (hsChoose 322) (16 :: Integer)
cbits/combinatorics.c view
@@ -1,7 +1,7 @@ /* ** ** The C code is generated by [ATS/Postiats-0-3-8]-** The starting compilation time is: 2018-1-7: 19h:36m+** The starting compilation time is: 2018-1-7: 20h:40m ** */ @@ -546,7 +546,7 @@ #if(0) ATSextern() atstkind_type(atstype_ptrk)-double_factorial(atstkind_t0ype(atstype_int)) ;+double_factorial_ats(atstkind_t0ype(atstype_int)) ; #endif // end of [QUALIFIED] #if(0)@@ -2684,7 +2684,7 @@ } /* end of [ATSCNTRB_056_HX_056_intinf_vt__intinf_free__19__2] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 593(line=28, offs=22) -- 616(line=29, offs=15)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 597(line=28, offs=22) -- 620(line=29, offs=15) */ /* local: choose_21$0(level=0)@@ -2701,11 +2701,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 582(line=28, offs=11) -- 616(line=29, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 586(line=28, offs=11) -- 620(line=29, offs=15) */ ATSINSflab(__patsflab_choose_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 604(line=29, offs=3) -- 616(line=29, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 608(line=29, offs=3) -- 620(line=29, offs=15) */ ATSINSmove(tmpret83, choose_21(arg0, arg1)) ; @@ -2714,7 +2714,7 @@ } /* end of [choose_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 645(line=31, offs=28) -- 668(line=32, offs=15)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 649(line=31, offs=28) -- 672(line=32, offs=15) */ /* local: choose_21$0(level=0)@@ -2731,11 +2731,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 628(line=31, offs=11) -- 668(line=32, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 632(line=31, offs=11) -- 672(line=32, offs=15) */ ATSINSflab(__patsflab_permutations_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 656(line=32, offs=3) -- 668(line=32, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 660(line=32, offs=3) -- 672(line=32, offs=15) */ ATSINSmove(tmpret84, choose_21(arg0, arg1)) ; @@ -2744,37 +2744,37 @@ } /* end of [permutations_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 697(line=34, offs=28) -- 712(line=35, offs=10)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 705(line=34, offs=32) -- 720(line=35, offs=10) */ /* local: dfact_10$0(level=0)-global: dfact_10$0(level=0), double_factorial$38$0(level=0)+global: dfact_10$0(level=0), double_factorial_ats$38$0(level=0) local: global: */ ATSextern() atstkind_type(atstype_ptrk)-double_factorial(atstkind_t0ype(atstype_int) arg0)+double_factorial_ats(atstkind_t0ype(atstype_int) arg0) { /* tmpvardeclst(beg) */ ATStmpdec(tmpret85, atstkind_type(atstype_ptrk)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 680(line=34, offs=11) -- 713(line=35, offs=11)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 684(line=34, offs=11) -- 721(line=35, offs=11) */-ATSINSflab(__patsflab_double_factorial):+ATSINSflab(__patsflab_double_factorial_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 705(line=35, offs=3) -- 712(line=35, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 713(line=35, offs=3) -- 720(line=35, offs=10) */ ATSINSmove(tmpret85, dfact_10(arg0)) ; ATSfunbody_end() ATSreturn(tmpret85) ;-} /* end of [double_factorial] */+} /* end of [double_factorial_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 739(line=37, offs=25) -- 753(line=38, offs=9)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 747(line=37, offs=25) -- 761(line=38, offs=9) */ /* local: fact_0$0(level=0)@@ -2791,11 +2791,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 725(line=37, offs=11) -- 754(line=38, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 733(line=37, offs=11) -- 762(line=38, offs=10) */ ATSINSflab(__patsflab_factorial_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 747(line=38, offs=3) -- 753(line=38, offs=9)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 755(line=38, offs=3) -- 761(line=38, offs=9) */ ATSINSmove(tmpret86, fact_0(arg0)) ;
cbits/number-theory.c view
@@ -1,7 +1,7 @@ /* ** ** The C code is generated by [ATS/Postiats-0-3-8]-** The starting compilation time is: 2018-1-7: 19h:36m+** The starting compilation time is: 2018-1-7: 20h:55m ** */ @@ -668,7 +668,7 @@ #if(0) ATSextern() atstkind_t0ype(atstype_int)-gcd_ats(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ;+sum_divisors_ats(atstkind_t0ype(atstype_int)) ; #endif // end of [QUALIFIED] #if(0)@@ -2672,7 +2672,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__6] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1526(line=60, offs=4) -- 1837(line=72, offs=6)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1488(line=59, offs=4) -- 1799(line=71, offs=6) */ /* local: @@ -2689,11 +2689,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1526(line=60, offs=4) -- 1837(line=72, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1488(line=59, offs=4) -- 1799(line=71, offs=6) */ ATSINSflab(__patsflab_sum_divisors_48): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1566(line=61, offs=3) -- 1837(line=72, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1528(line=60, offs=3) -- 1799(line=71, offs=6) */ /* letpush(beg)@@ -2703,12 +2703,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1821(line=71, offs=5) -- 1831(line=71, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1783(line=70, offs=5) -- 1793(line=70, offs=15) */ ATSINSmove(tmpret86, loop_49(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1566(line=61, offs=3) -- 1837(line=72, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1528(line=60, offs=3) -- 1799(line=71, offs=6) */ /* INSletpop()@@ -2718,7 +2718,7 @@ } /* end of [sum_divisors_48] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1578(line=62, offs=9) -- 1811(line=69, offs=27)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1540(line=61, offs=9) -- 1773(line=68, offs=27) */ /* local: loop_49$0(level=1)@@ -2743,64 +2743,64 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1578(line=62, offs=9) -- 1811(line=69, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1540(line=61, offs=9) -- 1773(line=68, offs=27) */ ATSINSflab(__patsflab_loop_49): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1676(line=63, offs=10) -- 1684(line=63, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1638(line=62, offs=10) -- 1646(line=62, offs=18) */ ATSINSmove(tmp88, ATSLIB_056_prelude__gte_g1int_int__35__3(arg1, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1673(line=63, offs=7) -- 1811(line=69, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1635(line=62, offs=7) -- 1773(line=68, offs=27) */ ATSif( tmp88 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1698(line=64, offs=9) -- 1699(line=64, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1660(line=63, offs=9) -- 1661(line=63, offs=10) */ ATSINSmove(tmpret87, ATSPMVi0nt(0)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1722(line=66, offs=12) -- 1729(line=66, offs=19)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1684(line=65, offs=12) -- 1691(line=65, offs=19) */ ATSINSmove(tmp94, atspre_g0int_mod_int(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1722(line=66, offs=12) -- 1733(line=66, offs=23)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1684(line=65, offs=12) -- 1695(line=65, offs=23) */ ATSINSmove(tmp91, ATSLIB_056_prelude__eq_g0int_int__7__7(tmp94, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1719(line=66, offs=9) -- 1811(line=69, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1681(line=65, offs=9) -- 1773(line=68, offs=27) */ ATSif( tmp91 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1763(line=67, offs=25) -- 1770(line=67, offs=32)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1725(line=66, offs=25) -- 1732(line=66, offs=32) */ ATSINSmove(tmp96, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1755(line=67, offs=17) -- 1771(line=67, offs=33)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1717(line=66, offs=17) -- 1733(line=66, offs=33) */ ATSINSmove(tmp95, loop_49(arg0, tmp96)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1749(line=67, offs=11) -- 1771(line=67, offs=33)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1711(line=66, offs=11) -- 1733(line=66, offs=33) */ ATSINSmove(tmpret87, atspre_g0int_add_int(arg1, tmp95)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1803(line=69, offs=19) -- 1810(line=69, offs=26)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1765(line=68, offs=19) -- 1772(line=68, offs=26) */ ATSINSmove(tmp97, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1795(line=69, offs=11) -- 1811(line=69, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1757(line=68, offs=11) -- 1773(line=68, offs=27) */ ATStailcal_beg() ATSINSmove_tlcal(apy0, arg0) ;@@ -2899,7 +2899,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__7] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1903(line=75, offs=4) -- 1961(line=76, offs=22)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1804(line=73, offs=4) -- 1862(line=74, offs=22) */ /* local: sum_divisors_48$0(level=0)@@ -2917,16 +2917,16 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1903(line=75, offs=4) -- 1961(line=76, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1804(line=73, offs=4) -- 1862(line=74, offs=22) */ ATSINSflab(__patsflab_is_perfect_52): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1942(line=76, offs=3) -- 1956(line=76, offs=17)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1843(line=74, offs=3) -- 1857(line=74, offs=17) */ ATSINSmove(tmp101, sum_divisors_48(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1942(line=76, offs=3) -- 1961(line=76, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1843(line=74, offs=3) -- 1862(line=74, offs=22) */ ATSINSmove(tmpret98, ATSLIB_056_prelude__eq_g0int_int__7__8(tmp101, arg0)) ; @@ -2976,7 +2976,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__8] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1993(line=79, offs=4) -- 2374(line=94, offs=6)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1894(line=77, offs=4) -- 2275(line=92, offs=6) */ /* local: is_prime_16$0(level=0)@@ -2993,11 +2993,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1993(line=79, offs=4) -- 2374(line=94, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1894(line=77, offs=4) -- 2275(line=92, offs=6) */ ATSINSflab(__patsflab_little_omega_54): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2033(line=80, offs=3) -- 2374(line=94, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1934(line=78, offs=3) -- 2275(line=92, offs=6) */ /* letpush(beg)@@ -3007,12 +3007,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2358(line=93, offs=5) -- 2368(line=93, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2259(line=91, offs=5) -- 2269(line=91, offs=15) */ ATSINSmove(tmpret102, loop_55(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2033(line=80, offs=3) -- 2374(line=94, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1934(line=78, offs=3) -- 2275(line=92, offs=6) */ /* INSletpop()@@ -3022,7 +3022,7 @@ } /* end of [little_omega_54] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2045(line=81, offs=9) -- 2348(line=91, offs=27)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1946(line=79, offs=9) -- 2249(line=89, offs=27) */ /* local: is_prime_16$0(level=0), loop_55$0(level=1)@@ -3049,98 +3049,98 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2045(line=81, offs=9) -- 2348(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1946(line=79, offs=9) -- 2249(line=89, offs=27) */ ATSINSflab(__patsflab_loop_55): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2143(line=82, offs=10) -- 2151(line=82, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2044(line=80, offs=10) -- 2052(line=80, offs=18) */ ATSINSmove(tmp104, ATSLIB_056_prelude__gte_g1int_int__35__4(arg1, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2140(line=82, offs=7) -- 2348(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2041(line=80, offs=7) -- 2249(line=89, offs=27) */ ATSif( tmp104 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2168(line=83, offs=12) -- 2178(line=83, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2069(line=81, offs=12) -- 2079(line=81, offs=22) */ ATSINSmove(tmp107, is_prime_16(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2165(line=83, offs=9) -- 2221(line=86, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2066(line=81, offs=9) -- 2122(line=84, offs=12) */ ATSif( tmp107 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2195(line=84, offs=11) -- 2196(line=84, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2096(line=82, offs=11) -- 2097(line=82, offs=12) */ ATSINSmove(tmpret103, ATSPMVi0nt(1)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2220(line=86, offs=11) -- 2221(line=86, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2121(line=84, offs=11) -- 2122(line=84, offs=12) */ ATSINSmove(tmpret103, ATSPMVi0nt(0)) ; } /* ATSendif */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2145(line=86, offs=12) -- 2172(line=86, offs=39) */ ATSINSmove(tmp112, atspre_g0int_mod_int(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2145(line=86, offs=12) -- 2172(line=86, offs=39) */ ATSINSmove(tmp109, ATSLIB_056_prelude__eq_g0int_int__7__9(tmp112, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2145(line=86, offs=12) -- 2172(line=86, offs=39) */ ATSif( tmp109 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2145(line=86, offs=12) -- 2172(line=86, offs=39) */ ATSINSmove(tmp108, is_prime_16(arg1)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2145(line=86, offs=12) -- 2172(line=86, offs=39) */ ATSINSmove(tmp108, ATSPMVbool_false()) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2241(line=88, offs=9) -- 2348(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2142(line=86, offs=9) -- 2249(line=89, offs=27) */ ATSif( tmp108 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2300(line=89, offs=23) -- 2307(line=89, offs=30)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2201(line=87, offs=23) -- 2208(line=87, offs=30) */ ATSINSmove(tmp114, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2292(line=89, offs=15) -- 2308(line=89, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2193(line=87, offs=15) -- 2209(line=87, offs=31) */ ATSINSmove(tmp113, loop_55(arg0, tmp114)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2288(line=89, offs=11) -- 2308(line=89, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2189(line=87, offs=11) -- 2209(line=87, offs=31) */ ATSINSmove(tmpret103, atspre_g0int_add_int(ATSPMVi0nt(1), tmp113)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2340(line=91, offs=19) -- 2347(line=91, offs=26)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2241(line=89, offs=19) -- 2248(line=89, offs=26) */ ATSINSmove(tmp115, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2332(line=91, offs=11) -- 2348(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2233(line=89, offs=11) -- 2249(line=89, offs=27) */ ATStailcal_beg() ATSINSmove_tlcal(apy0, arg0) ;@@ -3239,7 +3239,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__9] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2408(line=97, offs=4) -- 2956(line=117, offs=10)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2309(line=95, offs=4) -- 2857(line=115, offs=10) */ /* local: is_prime_16$0(level=0)@@ -3256,11 +3256,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2408(line=97, offs=4) -- 2956(line=117, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2309(line=95, offs=4) -- 2857(line=115, offs=10) */ ATSINSflab(__patsflab_totient_58): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2441(line=98, offs=3) -- 2956(line=117, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2342(line=96, offs=3) -- 2857(line=115, offs=10) */ ATScaseof_beg() /*@@ -3268,15 +3268,15 @@ */ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2458(line=99, offs=7) -- 2459(line=99, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2359(line=97, offs=7) -- 2360(line=97, offs=8) */ ATSINSlab(__atstmplab6): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2416(line=97, offs=12) -- 2417(line=97, offs=13)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2317(line=95, offs=12) -- 2318(line=95, offs=13) */ ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(1))) { ATSINSgoto(__atstmplab8) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2459(line=99, offs=8) -- 2459(line=99, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2360(line=97, offs=8) -- 2360(line=97, offs=8) */ ATSINSlab(__atstmplab7): /*@@ -3286,14 +3286,14 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2463(line=99, offs=12) -- 2464(line=99, offs=13)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2364(line=97, offs=12) -- 2365(line=97, offs=13) */ ATSINSmove(tmpret116, ATSPMVi0nt(1)) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2472(line=100, offs=8) -- 2472(line=100, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2373(line=98, offs=8) -- 2373(line=98, offs=8) */ ATSINSlab(__atstmplab8): /*@@ -3303,7 +3303,7 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2498(line=102, offs=9) -- 2946(line=116, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2399(line=100, offs=9) -- 2847(line=114, offs=12) */ /* letpush(beg)@@ -3313,12 +3313,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2924(line=115, offs=11) -- 2934(line=115, offs=21)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2825(line=113, offs=11) -- 2835(line=113, offs=21) */ ATSINSmove(tmpret116, loop_59(ATSPMVi0nt(1), arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2498(line=102, offs=9) -- 2946(line=116, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2399(line=100, offs=9) -- 2847(line=114, offs=12) */ /* INSletpop()@@ -3335,7 +3335,7 @@ } /* end of [totient_58] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2516(line=103, offs=15) -- 2902(line=113, offs=31)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2417(line=101, offs=15) -- 2803(line=111, offs=31) */ /* local: is_prime_16$0(level=0), loop_59$0(level=1)@@ -3368,126 +3368,126 @@ */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2516(line=103, offs=15) -- 2902(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2417(line=101, offs=15) -- 2803(line=111, offs=31) */ ATSINSflab(__patsflab_loop_59): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2627(line=104, offs=16) -- 2633(line=104, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2528(line=102, offs=16) -- 2534(line=102, offs=22) */ ATSINSmove(tmp118, ATSLIB_056_prelude__gte_g1int_int__35__5(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2624(line=104, offs=13) -- 2902(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2525(line=102, offs=13) -- 2803(line=111, offs=31) */ ATSif( tmp118 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2656(line=105, offs=18) -- 2666(line=105, offs=28)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2557(line=103, offs=18) -- 2567(line=103, offs=28) */ ATSINSmove(tmp121, is_prime_16(arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2653(line=105, offs=15) -- 2731(line=108, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2554(line=103, offs=15) -- 2632(line=106, offs=18) */ ATSif( tmp121 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=106, offs=17) -- 2694(line=106, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2590(line=104, offs=17) -- 2595(line=104, offs=22) */ ATSINSmove(tmpret117, atspre_g1int_sub_int(arg1, ATSPMVi0nt(1))) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2730(line=108, offs=17) -- 2731(line=108, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2631(line=106, offs=17) -- 2632(line=106, offs=18) */ ATSINSmove(tmpret117, arg1) ; } /* ATSendif */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSINSmove(tmp127, atspre_g0int_mod_int(arg1, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSINSmove(tmp124, ATSLIB_056_prelude__eq_g0int_int__7__10(tmp127, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSif( tmp124 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSINSmove(tmp123, is_prime_16(arg0)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSINSmove(tmp123, ATSPMVbool_false()) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSif( tmp123 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSINSmove(tmp122, ATSLIB_056_prelude__neq_g1int_int__63__1(arg0, arg1)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2667(line=108, offs=18) -- 2701(line=108, offs=52) */ ATSINSmove(tmp122, ATSPMVbool_false()) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2763(line=110, offs=15) -- 2902(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2664(line=108, offs=15) -- 2803(line=111, offs=31) */ ATSif( tmp122 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2828(line=111, offs=23) -- 2833(line=111, offs=28)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2729(line=109, offs=23) -- 2734(line=109, offs=28) */ ATSINSmove(tmp134, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2823(line=111, offs=18) -- 2837(line=111, offs=32)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2724(line=109, offs=18) -- 2738(line=109, offs=32) */ ATSINSmove(tmp133, loop_59(tmp134, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2823(line=111, offs=18) -- 2841(line=111, offs=36)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2724(line=109, offs=18) -- 2742(line=109, offs=36) */ ATSINSmove(tmp132, atspre_g0int_div_int(tmp133, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2846(line=111, offs=41) -- 2851(line=111, offs=46)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2747(line=109, offs=41) -- 2752(line=109, offs=46) */ ATSINSmove(tmp135, atspre_g1int_sub_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2822(line=111, offs=17) -- 2852(line=111, offs=47)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2723(line=109, offs=17) -- 2753(line=109, offs=47) */ ATSINSmove(tmpret117, atspre_g0int_mul_int(tmp132, tmp135)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2893(line=113, offs=22) -- 2898(line=113, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2794(line=111, offs=22) -- 2799(line=111, offs=27) */ ATSINSmove(tmp136, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2888(line=113, offs=17) -- 2902(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2789(line=111, offs=17) -- 2803(line=111, offs=31) */ ATStailcal_beg() ATSINSmove_tlcal(apy0, tmp136) ;@@ -3673,7 +3673,7 @@ } /* end of [ATSLIB_056_prelude__neq_g1int_int__63__1] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3009(line=120, offs=5) -- 3397(line=134, offs=6)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2910(line=118, offs=5) -- 3298(line=132, offs=6) */ /* local: witness_12$0(level=0), totient_58$0(level=0)@@ -3690,11 +3690,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3009(line=120, offs=5) -- 3397(line=134, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2910(line=118, offs=5) -- 3298(line=132, offs=6) */ ATSINSflab(__patsflab_totient_sum_66): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3049(line=121, offs=3) -- 3397(line=134, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2950(line=119, offs=3) -- 3298(line=132, offs=6) */ /* letpush(beg)@@ -3704,12 +3704,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3381(line=133, offs=5) -- 3391(line=133, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3282(line=131, offs=5) -- 3292(line=131, offs=15) */ ATSINSmove(tmpret137, loop_67(ATSPMVi0nt(1), arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3049(line=121, offs=3) -- 3397(line=134, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2950(line=119, offs=3) -- 3298(line=132, offs=6) */ /* INSletpop()@@ -3719,7 +3719,7 @@ } /* end of [totient_sum_66] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3061(line=122, offs=9) -- 3371(line=131, offs=40)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2962(line=120, offs=9) -- 3272(line=129, offs=40) */ /* local: witness_12$0(level=0), totient_58$0(level=0), loop_67$0(level=1)@@ -3748,33 +3748,33 @@ */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3061(line=122, offs=9) -- 3371(line=131, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2962(line=120, offs=9) -- 3272(line=129, offs=40) */ ATSINSflab(__patsflab_loop_67): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3164(line=123, offs=10) -- 3173(line=123, offs=19)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3065(line=121, offs=10) -- 3074(line=121, offs=19) */ ATSINSmove(tmp139, ATSLIB_056_prelude__lt_g1int_int__18__2(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3161(line=123, offs=7) -- 3371(line=131, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3062(line=121, offs=7) -- 3272(line=129, offs=40) */ ATSif( tmp139 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3187(line=124, offs=9) -- 3320(line=129, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3088(line=122, offs=9) -- 3221(line=127, offs=12) */ /* letpush(beg) */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3214(line=125, offs=24) -- 3219(line=125, offs=29)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3115(line=123, offs=24) -- 3120(line=123, offs=29) */ ATSINSmove(tmp143, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3209(line=125, offs=19) -- 3227(line=125, offs=37)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3110(line=123, offs=19) -- 3128(line=123, offs=37) */ ATSINSmove(tmp142, loop_67(tmp143, arg1)) ; @@ -3783,39 +3783,39 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3273(line=126, offs=46) -- 3282(line=126, offs=55)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3174(line=124, offs=46) -- 3183(line=124, offs=55) */ ATSINSmove(tmp149, totient_58(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3265(line=126, offs=38) -- 3284(line=126, offs=57)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3166(line=124, offs=38) -- 3185(line=124, offs=57) */ ATSINSmove(tmp148, witness_12(tmp149)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3246(line=126, offs=19) -- 3285(line=126, offs=58)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3147(line=124, offs=19) -- 3186(line=124, offs=58) */ ATSINSmove(tmpret138, ATSCNTRB_056_HX_056_intinf_vt__add_intinf0_int__69__1(tmp142, tmp148)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3187(line=124, offs=9) -- 3320(line=129, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3088(line=122, offs=9) -- 3221(line=127, offs=12) */ /* INSletpop() */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3340(line=131, offs=9) -- 3371(line=131, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3241(line=129, offs=9) -- 3272(line=129, offs=40) */ ATSINSmove(tmp159, totient_58(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3340(line=131, offs=9) -- 3371(line=131, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3241(line=129, offs=9) -- 3272(line=129, offs=40) */ ATSINSmove(tmp158, witness_12(tmp159)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3340(line=131, offs=9) -- 3371(line=131, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3241(line=129, offs=9) -- 3272(line=129, offs=40) */ ATSINSmove(tmpret138, ATSCNTRB_056_HX_056_intinf_vt__intinf_make_int__71__1(tmp158)) ; @@ -4181,37 +4181,37 @@ } /* end of [ATSLIB_056_prelude__ptr_alloc__73__1] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 482(line=26, offs=19) -- 502(line=27, offs=12)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 491(line=26, offs=28) -- 513(line=27, offs=17) */ /*-local: gcd_29$0(level=0)-global: witness_12$0(level=0), gcd_29$0(level=0), gcd_ats$75$0(level=0)+local: sum_divisors_48$0(level=0)+global: sum_divisors_48$0(level=0), sum_divisors_ats$75$0(level=0) local: global: */ ATSextern() atstkind_t0ype(atstype_int)-gcd_ats(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1)+sum_divisors_ats(atstkind_t0ype(atstype_int) arg0) { /* tmpvardeclst(beg) */ ATStmpdec(tmpret160, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 474(line=26, offs=11) -- 502(line=27, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 474(line=26, offs=11) -- 514(line=27, offs=18) */-ATSINSflab(__patsflab_gcd_ats):+ATSINSflab(__patsflab_sum_divisors_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 493(line=27, offs=3) -- 502(line=27, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 499(line=27, offs=3) -- 513(line=27, offs=17) */-ATSINSmove(tmpret160, gcd_29(arg0, arg1)) ;+ATSINSmove(tmpret160, sum_divisors_48(arg0)) ; ATSfunbody_end() ATSreturn(tmpret160) ;-} /* end of [gcd_ats] */+} /* end of [sum_divisors_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 533(line=29, offs=30) -- 557(line=30, offs=19)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 545(line=29, offs=30) -- 569(line=30, offs=19) */ /* local: count_divisors_43$0(level=0)@@ -4228,11 +4228,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 514(line=29, offs=11) -- 558(line=30, offs=20)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 526(line=29, offs=11) -- 570(line=30, offs=20) */ ATSINSflab(__patsflab_count_divisors_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 541(line=30, offs=3) -- 557(line=30, offs=19)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 553(line=30, offs=3) -- 569(line=30, offs=19) */ ATSINSmove(tmpret161, count_divisors_43(arg0)) ; @@ -4241,7 +4241,7 @@ } /* end of [count_divisors_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 582(line=32, offs=23) -- 599(line=33, offs=12)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 594(line=32, offs=23) -- 611(line=33, offs=12) */ /* local: totient_58$0(level=0)@@ -4258,11 +4258,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 570(line=32, offs=11) -- 600(line=33, offs=13)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 582(line=32, offs=11) -- 612(line=33, offs=13) */ ATSINSflab(__patsflab_totient_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 590(line=33, offs=3) -- 599(line=33, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 602(line=33, offs=3) -- 611(line=33, offs=12) */ ATSINSmove(tmpret162, totient_58(arg0)) ; @@ -4271,7 +4271,7 @@ } /* end of [totient_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 629(line=35, offs=28) -- 651(line=36, offs=17)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 641(line=35, offs=28) -- 663(line=36, offs=17) */ /* local: little_omega_54$0(level=0)@@ -4288,11 +4288,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 612(line=35, offs=11) -- 652(line=36, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 624(line=35, offs=11) -- 664(line=36, offs=18) */ ATSINSflab(__patsflab_little_omega_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 637(line=36, offs=3) -- 651(line=36, offs=17)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 649(line=36, offs=3) -- 663(line=36, offs=17) */ ATSINSmove(tmpret163, little_omega_54(arg0)) ; @@ -4301,7 +4301,7 @@ } /* end of [little_omega_ats] */ /*-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 679(line=38, offs=26) -- 699(line=39, offs=15)+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 691(line=38, offs=26) -- 711(line=39, offs=15) */ /* local: is_perfect_52$0(level=0)@@ -4318,11 +4318,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 664(line=38, offs=11) -- 700(line=39, offs=16)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 676(line=38, offs=11) -- 712(line=39, offs=16) */ ATSINSflab(__patsflab_is_perfect_ats): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 687(line=39, offs=3) -- 699(line=39, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory-ffi.dats: 699(line=39, offs=3) -- 711(line=39, offs=15) */ ATSINSmove(tmpret164, is_perfect_52(arg0)) ;
cbits/numerics.c view
@@ -1,7 +1,7 @@ /* ** ** The C code is generated by [ATS/Postiats-0-3-8]-** The starting compilation time is: 2018-1-7: 19h:36m+** The starting compilation time is: 2018-1-7: 20h:35m ** */
fast-arithmetic.cabal view
@@ -1,5 +1,5 @@ name: fast-arithmetic-version: 0.1.1.3+version: 0.1.1.4 synopsis: Fast functions on integers. description: Fast functions for number theory and combinatorics with a high level of safety guaranteed by [ATS](http://www.ats-lang.org/). This package also provides a 'Storable' instance for GMP's @mpz@ type.@@ -93,4 +93,4 @@ source-repository head type: git- location: https://github.com/vmchale/fast-arithmetic+ location: git@github.com:vmchale/fast-arithmetic.git
src/Numeric/Combinatorics.hs view
@@ -8,6 +8,7 @@ module Numeric.Combinatorics ( factorial , choose+ , doubleFactorial ) where import Control.Composition@@ -17,11 +18,16 @@ import Foreign.Storable foreign import ccall unsafe factorial_ats :: CInt -> Ptr GMPInt+foreign import ccall unsafe double_factorial_ats :: CInt -> Ptr GMPInt foreign import ccall unsafe choose_ats :: CInt -> CInt -> Ptr GMPInt -- | See [here](http://mathworld.wolfram.com/BinomialCoefficient.html). choose :: Int -> Int -> IO Integer choose = (gmpToInteger <=<) . (peek .* on choose_ats fromIntegral)++-- | See [here](http://mathworld.wolfram.com/DoubleFactorial.html).+doubleFactorial :: Int -> IO Integer+doubleFactorial = gmpToInteger <=< (peek . double_factorial_ats . fromIntegral) factorial :: Int -> IO Integer factorial = gmpToInteger <=< (peek . factorial_ats . fromIntegral)
src/Numeric/NumberTheory.hs view
@@ -11,6 +11,7 @@ , tau , littleOmega , isPerfect+ , sumDivisors ) where import Foreign.C@@ -18,6 +19,7 @@ foreign import ccall unsafe totient_ats :: CInt -> CInt foreign import ccall unsafe count_divisors_ats :: CInt -> CInt+foreign import ccall unsafe sum_divisors_ats :: CInt -> CInt foreign import ccall unsafe little_omega_ats :: CInt -> CInt #if __GLASGOW_HASKELL__ >= 820 foreign import ccall unsafe is_perfect_ats :: CInt -> CBool@@ -28,6 +30,10 @@ -- | See [here](http://mathworld.wolfram.com/PerfectNumber.html) isPerfect :: Int -> Bool isPerfect = asTest is_perfect_ats++-- | Sum of proper divisors.+sumDivisors :: Int -> Int+sumDivisors = conjugate sum_divisors_ats -- Number of distinct prime factors littleOmega :: Int -> Int
src/Numeric/Pure.hs view
@@ -11,6 +11,7 @@ , hsTotientSum , hsLittleOmega , hsIsPerfect+ , hsSumDivisors ) where #if __GLASGOW_HASKELL__ <= 784@@ -23,7 +24,6 @@ {-# SPECIALIZE hsTotient :: Int -> Int #-} {-# SPECIALIZE hsIsPrime :: Int -> Bool #-} {-# SPECIALIZE hsChoose :: Int -> Int -> Int #-}-{-# SPECIALIZE hsIsPerfect :: Int -> Bool #-} {-# SPECIALIZE hsDoubleFactorial :: Int -> Int #-} divisors :: (Integral a) => a -> [a]
test/Spec.hs view
@@ -27,9 +27,9 @@ main = hspec $ parallel $ do sequence_ $ zipWith3 agree- ["totient", "tau", "littleOmega"]- [totient, tau, littleOmega]- [hsTotient, hsTau, hsLittleOmega]+ ["totient", "tau", "littleOmega", "sumDivisors"]+ [totient, tau, littleOmega, sumDivisors]+ [hsTotient, hsTau, hsLittleOmega, hsSumDivisors] sequence_ $ zipWith3 agree ["isPrime", "isPerfect"]@@ -45,7 +45,7 @@ -- TODO property test w/ recurrence relations? sequence_ $ zipWith4 check- ["factorial", "choose"]- [factorial, choose 101]- [hsFactorial, hsChoose 101]- [3141, 16]+ ["factorial", "choose", "doubleFactorial"]+ [factorial, choose 101, doubleFactorial]+ [hsFactorial, hsChoose 101, hsDoubleFactorial]+ [3141, 16, 79]