fast-arithmetic 0.1.0.0 → 0.1.0.1
raw patch · 7 files changed
+93/−101 lines, 7 filessetup-changed
Files
- README.md +0/−2
- Setup.hs +2/−2
- ats-src/combinatorics.dats +6/−13
- ats-src/number-theory.dats +1/−0
- cbits/number-theory.c +81/−81
- cbits/numerics.c +1/−1
- fast-arithmetic.cabal +2/−2
README.md view
@@ -21,8 +21,6 @@ | `τ(3018)` | Haskell | 35.87 μs | | `ω(91)` | ATS | 282.1 ns | | `ω(91)` | Haskell | 1.194 μs |-| `gcd(201, 67)` | ATS | 8.848 ns |-| `gcd(201, 67)` | Haskell | 11.26 ns | ## Building
Setup.hs view
@@ -21,9 +21,9 @@ main = defaultMainWithHooks myHooks where myHooks = simpleUserHooks { preConf = buildScript- , postBuild = maybeCleanATS }+ , postReg = maybeCleanATS } -maybeCleanATS :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()+maybeCleanATS :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO () maybeCleanATS _ _ _ li = let cf = configConfigurationsFlags (configFlags li) in
ats-src/combinatorics.dats view
@@ -11,14 +11,7 @@ case+ k of | 0 => int2intinf(1) | 1 => int2intinf(1)- | k =>> let- val x = fact(k - 1) * k- in- if compare(x, 0) = 1 then- x- else- int2intinf(1)- end+ | k =>> $UN.cast(fact(k - 1) * k) // double factorial http://mathworld.wolfram.com/DoubleFactorial.html fnx dfact {n : nat} .<n>. (k : int(n)) : Intinf =@@ -29,19 +22,19 @@ // Number of permutations on n objects using k at a time. fn permutatsions {n : nat}{ k : nat | k <= n } (n : int(n), k : int(k)) : Intinf =- fact(n) / fact(n - k)+ ndiv(fact(n), fact(n - k)) // Number of permutations on n objects using k at a time. fn choose {n : nat}{ m : nat | m <= n } (n : int(n), k : int(m)) : Intinf = let- fun numerator_loop { m : nat | m > 1 } .<m>. (i : int(m)) : Intinf =+ fun numerator_loop { m : nat | m > 1 } .<m>. (i : int(m)) : [ n : nat | n > 0 ] intinf(n) = case+ i of | 1 => int2intinf(n)- | 2 => int2intinf(n - 1) * n- | i =>> (n + 1 - i) * numerator_loop(i - 1)+ | 2 => $UN.cast(int2intinf(n - 1) * n)+ | i =>> $UN.cast((n + 1 - i) * numerator_loop(i - 1)) in case+ k of | 0 => int2intinf(1) | 1 => int2intinf(n)- | k =>> numerator_loop(k) / fact(k)+ | k =>> ndiv(numerator_loop(k), fact(k)) end
ats-src/number-theory.dats view
@@ -72,6 +72,7 @@ loop(n, 1) end +// TODO proofs of correctness like HX for fibonacci numbers? fn is_perfect(n : intGte(1)) :<> bool = sum_divisors(n) = n
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-4: 0h:59m+** The starting compilation time is: 2018-1-4: 1h:45m ** */ @@ -9950,7 +9950,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__7] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 1918(line=75, offs=4) -- 1976(line=76, offs=22)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 1979(line=76, offs=4) -- 2037(line=77, offs=22) */ /* local: sum_divisors_151$0(level=0)@@ -9968,16 +9968,16 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 1918(line=75, offs=4) -- 1976(line=76, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 1979(line=76, offs=4) -- 2037(line=77, offs=22) */ ATSINSflab(__patsflab_is_perfect_155): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 1957(line=76, offs=3) -- 1971(line=76, offs=17)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2018(line=77, offs=3) -- 2032(line=77, offs=17) */ ATSINSmove(tmp361, sum_divisors_151(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 1957(line=76, offs=3) -- 1976(line=76, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2018(line=77, offs=3) -- 2037(line=77, offs=22) */ ATSINSmove(tmpret358, ATSLIB_056_prelude__eq_g0int_int__7__8(tmp361, arg0)) ; @@ -10027,7 +10027,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__8] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2008(line=79, offs=4) -- 2389(line=94, offs=6)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2069(line=80, offs=4) -- 2450(line=95, offs=6) */ /* local: is_prime_16$0(level=0)@@ -10044,11 +10044,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2008(line=79, offs=4) -- 2389(line=94, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2069(line=80, offs=4) -- 2450(line=95, offs=6) */ ATSINSflab(__patsflab_little_omega_157): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2048(line=80, offs=3) -- 2389(line=94, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2109(line=81, offs=3) -- 2450(line=95, offs=6) */ /* letpush(beg)@@ -10058,12 +10058,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2373(line=93, offs=5) -- 2383(line=93, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2434(line=94, offs=5) -- 2444(line=94, offs=15) */ ATSINSmove(tmpret362, loop_158(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2048(line=80, offs=3) -- 2389(line=94, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2109(line=81, offs=3) -- 2450(line=95, offs=6) */ /* INSletpop()@@ -10073,7 +10073,7 @@ } /* end of [little_omega_157] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2060(line=81, offs=9) -- 2363(line=91, offs=27)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2121(line=82, offs=9) -- 2424(line=92, offs=27) */ /* local: is_prime_16$0(level=0), loop_158$0(level=1)@@ -10100,98 +10100,98 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2060(line=81, offs=9) -- 2363(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2121(line=82, offs=9) -- 2424(line=92, offs=27) */ ATSINSflab(__patsflab_loop_158): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2158(line=82, offs=10) -- 2166(line=82, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2219(line=83, offs=10) -- 2227(line=83, offs=18) */ ATSINSmove(tmp364, ATSLIB_056_prelude__gte_g1int_int__138__4(arg1, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2155(line=82, offs=7) -- 2363(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2216(line=83, offs=7) -- 2424(line=92, offs=27) */ ATSif( tmp364 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2183(line=83, offs=12) -- 2193(line=83, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2244(line=84, offs=12) -- 2254(line=84, offs=22) */ ATSINSmove(tmp367, is_prime_16(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2180(line=83, offs=9) -- 2236(line=86, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2241(line=84, offs=9) -- 2297(line=87, offs=12) */ ATSif( tmp367 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2210(line=84, offs=11) -- 2211(line=84, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2271(line=85, offs=11) -- 2272(line=85, offs=12) */ ATSINSmove(tmpret363, ATSPMVi0nt(1)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2235(line=86, offs=11) -- 2236(line=86, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2296(line=87, offs=11) -- 2297(line=87, offs=12) */ ATSINSmove(tmpret363, ATSPMVi0nt(0)) ; } /* ATSendif */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2259(line=88, offs=12) -- 2286(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2320(line=89, offs=12) -- 2347(line=89, offs=39) */ ATSINSmove(tmp372, atspre_g0int_mod_int(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2259(line=88, offs=12) -- 2286(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2320(line=89, offs=12) -- 2347(line=89, offs=39) */ ATSINSmove(tmp369, ATSLIB_056_prelude__eq_g0int_int__7__9(tmp372, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2259(line=88, offs=12) -- 2286(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2320(line=89, offs=12) -- 2347(line=89, offs=39) */ ATSif( tmp369 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2259(line=88, offs=12) -- 2286(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2320(line=89, offs=12) -- 2347(line=89, offs=39) */ ATSINSmove(tmp368, is_prime_16(arg1)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2259(line=88, offs=12) -- 2286(line=88, offs=39)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2320(line=89, offs=12) -- 2347(line=89, offs=39) */ ATSINSmove(tmp368, ATSPMVbool_false()) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2256(line=88, offs=9) -- 2363(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2317(line=89, offs=9) -- 2424(line=92, offs=27) */ ATSif( tmp368 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2315(line=89, offs=23) -- 2322(line=89, offs=30)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2376(line=90, offs=23) -- 2383(line=90, offs=30) */ ATSINSmove(tmp374, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2307(line=89, offs=15) -- 2323(line=89, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2368(line=90, offs=15) -- 2384(line=90, offs=31) */ ATSINSmove(tmp373, loop_158(arg0, tmp374)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2303(line=89, offs=11) -- 2323(line=89, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2364(line=90, offs=11) -- 2384(line=90, offs=31) */ ATSINSmove(tmpret363, atspre_g0int_add_int(ATSPMVi0nt(1), tmp373)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2355(line=91, offs=19) -- 2362(line=91, offs=26)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2416(line=92, offs=19) -- 2423(line=92, offs=26) */ ATSINSmove(tmp375, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2347(line=91, offs=11) -- 2363(line=91, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2408(line=92, offs=11) -- 2424(line=92, offs=27) */ ATStailcal_beg() ATSINSmove_tlcal(apy0, arg0) ;@@ -10290,7 +10290,7 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__9] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2423(line=97, offs=4) -- 2971(line=117, offs=10)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2484(line=98, offs=4) -- 3032(line=118, offs=10) */ /* local: is_prime_16$0(level=0)@@ -10307,11 +10307,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2423(line=97, offs=4) -- 2971(line=117, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2484(line=98, offs=4) -- 3032(line=118, offs=10) */ ATSINSflab(__patsflab_totient_161): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2456(line=98, offs=3) -- 2971(line=117, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2517(line=99, offs=3) -- 3032(line=118, offs=10) */ ATScaseof_beg() /*@@ -10319,15 +10319,15 @@ */ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2473(line=99, offs=7) -- 2474(line=99, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2534(line=100, offs=7) -- 2535(line=100, offs=8) */ ATSINSlab(__atstmplab6): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2431(line=97, offs=12) -- 2432(line=97, offs=13)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2492(line=98, offs=12) -- 2493(line=98, offs=13) */ ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(1))) { ATSINSgoto(__atstmplab8) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2474(line=99, offs=8) -- 2474(line=99, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2535(line=100, offs=8) -- 2535(line=100, offs=8) */ ATSINSlab(__atstmplab7): /*@@ -10337,14 +10337,14 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2478(line=99, offs=12) -- 2479(line=99, offs=13)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2539(line=100, offs=12) -- 2540(line=100, offs=13) */ ATSINSmove(tmpret376, ATSPMVi0nt(1)) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2487(line=100, offs=8) -- 2487(line=100, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2548(line=101, offs=8) -- 2548(line=101, offs=8) */ ATSINSlab(__atstmplab8): /*@@ -10354,7 +10354,7 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2513(line=102, offs=9) -- 2961(line=116, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2574(line=103, offs=9) -- 3022(line=117, offs=12) */ /* letpush(beg)@@ -10364,12 +10364,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2939(line=115, offs=11) -- 2949(line=115, offs=21)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3000(line=116, offs=11) -- 3010(line=116, offs=21) */ ATSINSmove(tmpret376, loop_162(ATSPMVi0nt(1), arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2513(line=102, offs=9) -- 2961(line=116, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2574(line=103, offs=9) -- 3022(line=117, offs=12) */ /* INSletpop()@@ -10386,7 +10386,7 @@ } /* end of [totient_161] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2531(line=103, offs=15) -- 2917(line=113, offs=31)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2592(line=104, offs=15) -- 2978(line=114, offs=31) */ /* local: is_prime_16$0(level=0), loop_162$0(level=1)@@ -10419,126 +10419,126 @@ */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2531(line=103, offs=15) -- 2917(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2592(line=104, offs=15) -- 2978(line=114, offs=31) */ ATSINSflab(__patsflab_loop_162): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2642(line=104, offs=16) -- 2648(line=104, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2703(line=105, offs=16) -- 2709(line=105, offs=22) */ ATSINSmove(tmp378, ATSLIB_056_prelude__gte_g1int_int__138__5(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2639(line=104, offs=13) -- 2917(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2700(line=105, offs=13) -- 2978(line=114, offs=31) */ ATSif( tmp378 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2671(line=105, offs=18) -- 2681(line=105, offs=28)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2732(line=106, offs=18) -- 2742(line=106, offs=28) */ ATSINSmove(tmp381, is_prime_16(arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2668(line=105, offs=15) -- 2746(line=108, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2729(line=106, offs=15) -- 2807(line=109, offs=18) */ ATSif( tmp381 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2704(line=106, offs=17) -- 2709(line=106, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2765(line=107, offs=17) -- 2770(line=107, offs=22) */ ATSINSmove(tmpret377, atspre_g1int_sub_int(arg1, ATSPMVi0nt(1))) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2745(line=108, offs=17) -- 2746(line=108, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2806(line=109, offs=17) -- 2807(line=109, offs=18) */ ATSINSmove(tmpret377, arg1) ; } /* ATSendif */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSINSmove(tmp387, atspre_g0int_mod_int(arg1, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSINSmove(tmp384, ATSLIB_056_prelude__eq_g0int_int__7__10(tmp387, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSif( tmp384 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSINSmove(tmp383, is_prime_16(arg0)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSINSmove(tmp383, ATSPMVbool_false()) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSif( tmp383 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSINSmove(tmp382, ATSLIB_056_prelude__neq_g1int_int__166__1(arg0, arg1)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2781(line=110, offs=18) -- 2815(line=110, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2842(line=111, offs=18) -- 2876(line=111, offs=52) */ ATSINSmove(tmp382, ATSPMVbool_false()) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2778(line=110, offs=15) -- 2917(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2839(line=111, offs=15) -- 2978(line=114, offs=31) */ ATSif( tmp382 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2843(line=111, offs=23) -- 2848(line=111, offs=28)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2904(line=112, offs=23) -- 2909(line=112, offs=28) */ ATSINSmove(tmp394, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2838(line=111, offs=18) -- 2852(line=111, offs=32)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2899(line=112, offs=18) -- 2913(line=112, offs=32) */ ATSINSmove(tmp393, loop_162(tmp394, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2838(line=111, offs=18) -- 2856(line=111, offs=36)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2899(line=112, offs=18) -- 2917(line=112, offs=36) */ ATSINSmove(tmp392, atspre_g0int_div_int(tmp393, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2861(line=111, offs=41) -- 2866(line=111, offs=46)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2922(line=112, offs=41) -- 2927(line=112, offs=46) */ ATSINSmove(tmp395, atspre_g1int_sub_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2837(line=111, offs=17) -- 2867(line=111, offs=47)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2898(line=112, offs=17) -- 2928(line=112, offs=47) */ ATSINSmove(tmpret377, atspre_g0int_mul_int(tmp392, tmp395)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2908(line=113, offs=22) -- 2913(line=113, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2969(line=114, offs=22) -- 2974(line=114, offs=27) */ ATSINSmove(tmp396, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2903(line=113, offs=17) -- 2917(line=113, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 2964(line=114, offs=17) -- 2978(line=114, offs=31) */ ATStailcal_beg() ATSINSmove_tlcal(apy0, tmp396) ;@@ -10724,7 +10724,7 @@ } /* end of [ATSLIB_056_prelude__neq_g1int_int__166__1] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3024(line=120, offs=5) -- 3319(line=129, offs=6)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3085(line=121, offs=5) -- 3380(line=130, offs=6) */ /* local: witness_12$0(level=0), totient_161$0(level=0)@@ -10741,11 +10741,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3024(line=120, offs=5) -- 3319(line=129, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3085(line=121, offs=5) -- 3380(line=130, offs=6) */ ATSINSflab(__patsflab_totient_sum_169): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3064(line=121, offs=3) -- 3319(line=129, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3125(line=122, offs=3) -- 3380(line=130, offs=6) */ /* letpush(beg)@@ -10755,12 +10755,12 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3303(line=128, offs=5) -- 3313(line=128, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3364(line=129, offs=5) -- 3374(line=129, offs=15) */ ATSINSmove(tmpret397, loop_170(ATSPMVi0nt(1), arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3064(line=121, offs=3) -- 3319(line=129, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3125(line=122, offs=3) -- 3380(line=130, offs=6) */ /* INSletpop()@@ -10770,7 +10770,7 @@ } /* end of [totient_sum_169] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3076(line=122, offs=9) -- 3293(line=126, offs=40)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3137(line=123, offs=9) -- 3354(line=127, offs=40) */ /* local: witness_12$0(level=0), totient_161$0(level=0), loop_170$0(level=1)@@ -10799,58 +10799,58 @@ */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3076(line=122, offs=9) -- 3293(line=126, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3137(line=123, offs=9) -- 3354(line=127, offs=40) */ ATSINSflab(__patsflab_loop_170): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3179(line=123, offs=10) -- 3188(line=123, offs=19)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3240(line=124, offs=10) -- 3249(line=124, offs=19) */ ATSINSmove(tmp399, ATSLIB_056_prelude__lt_g1int_int__18__2(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3176(line=123, offs=7) -- 3293(line=126, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3237(line=124, offs=7) -- 3354(line=127, offs=40) */ ATSif( tmp399 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3207(line=124, offs=14) -- 3212(line=124, offs=19)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3268(line=125, offs=14) -- 3273(line=125, offs=19) */ ATSINSmove(tmp411, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3202(line=124, offs=9) -- 3220(line=124, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3263(line=125, offs=9) -- 3281(line=125, offs=27) */ ATSINSmove(tmp410, loop_170(tmp411, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3231(line=124, offs=38) -- 3240(line=124, offs=47)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3292(line=125, offs=38) -- 3301(line=125, offs=47) */ ATSINSmove(tmp413, totient_161(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3223(line=124, offs=30) -- 3242(line=124, offs=49)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3284(line=125, offs=30) -- 3303(line=125, offs=49) */ ATSINSmove(tmp412, witness_12(tmp413)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3202(line=124, offs=9) -- 3242(line=124, offs=49)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3263(line=125, offs=9) -- 3303(line=125, offs=49) */ ATSINSmove(tmpret398, ATSCNTRB_056_HX_056_intinf_t__add_intinf_int__42__1(tmp410, tmp412)) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3262(line=126, offs=9) -- 3293(line=126, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3323(line=127, offs=9) -- 3354(line=127, offs=40) */ ATSINSmove(tmp421, totient_161(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3262(line=126, offs=9) -- 3293(line=126, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3323(line=127, offs=9) -- 3354(line=127, offs=40) */ ATSINSmove(tmp420, witness_12(tmp421)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3262(line=126, offs=9) -- 3293(line=126, offs=40)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/number-theory.dats: 3323(line=127, offs=9) -- 3354(line=127, offs=40) */ ATSINSmove(tmpret398, ATSCNTRB_056_HX_056_intinf_t__intinf_make_int__27__1(tmp420)) ;
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-4: 0h:59m+** The starting compilation time is: 2018-1-4: 1h:45m ** */
fast-arithmetic.cabal view
@@ -1,5 +1,5 @@ name: fast-arithmetic-version: 0.1.0.0+version: 0.1.0.1 synopsis: Fast number-theoretic functions. description: Fast number-theoretic code with a high level of safety guaranteed by ATS. homepage: https://github.com/vmchale/fast-arithmetic#readme@@ -40,8 +40,8 @@ , cbits/number-theory.c include-dirs: ats-deps/ , ats-deps/contrib- , ats-deps/prelude/ATS2-Postiats-include-0.3.8 , ats-deps/prelude/ATS2-Postiats-include-0.3.8/ccomp/runtime+ , ats-deps/prelude/ATS2-Postiats-include-0.3.8 hs-source-dirs: src exposed-modules: Numeric.Pure , Numeric.Integer