| 1 |
(* hol_test *) |
| 2 |
|
| 3 |
needs "Formal_ineqs/tests/test_utils.hl";; |
| 4 |
|
| 5 |
show_result := true;; |
| 6 |
let rep = 1;; |
| 7 |
|
| 8 |
show_result := false;; |
| 9 |
let rep = 10;; |
| 10 |
|
| 11 |
(* sin_cos *) |
| 12 |
ftest2 rep "log_sin_cos/add_hi.log" Arith_float.float_add_hi;; |
| 13 |
ftest2 rep "log_sin_cos/add_lo.log" Arith_float.float_add_lo;; |
| 14 |
ftest2 rep "log_sin_cos/sub_hi.log" Arith_float.float_sub_hi;; |
| 15 |
ftest2 rep "log_sin_cos/sub_lo.log" Arith_float.float_sub_lo;; |
| 16 |
ftest2 rep "log_sin_cos/mul_hi.log" Arith_float.float_mul_hi;; |
| 17 |
ftest2 rep "log_sin_cos/mul_lo.log" Arith_float.float_mul_lo;; |
| 18 |
|
| 19 |
|
| 20 |
(* poly *) |
| 21 |
ftest2 rep "log_poly/add_hi.log" Arith_float.float_add_hi;; |
| 22 |
ftest2 rep "log_poly/add_lo.log" Arith_float.float_add_lo;; |
| 23 |
ftest2 rep "log_poly/sub_hi.log" Arith_float.float_sub_hi;; |
| 24 |
ftest2 rep "log_poly/sub_lo.log" Arith_float.float_sub_lo;; |
| 25 |
ftest2 rep "log_poly/mul_hi.log" Arith_float.float_mul_hi;; |
| 26 |
ftest2 rep "log_poly/mul_lo.log" Arith_float.float_mul_lo;; |
| 27 |
|
| 28 |
(* big *) |
| 29 |
let rep = 1;; |
| 30 |
(* 100: 262.728 *) |
| 31 |
ftest2 rep "log_big/add_hi.log" Arith_float.float_add_hi;; |
| 32 |
(* 100: 102.499 *) |
| 33 |
ftest2 rep "log_big/add_lo.log" Arith_float.float_add_lo;; |
| 34 |
(* 100: 6.178 *) |
| 35 |
ftest2 rep "log_big/sub_hi.log" Arith_float.float_sub_hi;; |
| 36 |
(* 100: 14.629 *) |
| 37 |
ftest2 rep "log_big/sub_lo.log" Arith_float.float_sub_lo;; |
| 38 |
(* 100: 439.638 *) |
| 39 |
ftest2 rep "log_big/mul_hi.log" Arith_float.float_mul_hi;; |
| 40 |
(* 100: 183.269 *) |
| 41 |
ftest2 rep "log_big/mul_lo.log" Arith_float.float_mul_lo;; |
| 42 |
(* 100: 4.667 *) |
| 43 |
ftest2 rep "log_big/div_hi.log" Arith_float.float_div_hi;; |
| 44 |
(* 100: 4.103 *) |
| 45 |
ftest2 rep "log_big/div_lo.log" Arith_float.float_div_lo;; |
| 46 |
|
| 47 |
|
| 48 |
arith_test1d rep "data/nat15.txt" |
| 49 |
`SUC` Arith_nat.raw_suc_conv_hash;; |
| 50 |
|
| 51 |
new_arith_test1d rep "data/nat15.txt" |
| 52 |
Nat_arith.nsuc;; |
| 53 |
|
| 54 |
|
| 55 |
(* Addition *) |
| 56 |
|
| 57 |
(* 100: 2.189 +/- 0.053 *) |
| 58 |
arith_test2d rep "data/nat10.txt" |
| 59 |
`(+):num->num->num` |
| 60 |
Arith_nat.raw_add_conv_hash;; |
| 61 |
|
| 62 |
(* 100: 2.041 +/- 0.024 *) |
| 63 |
new_arith_test2d rep "data/nat10.txt" |
| 64 |
Nat_arith.nadd;; |
| 65 |
|
| 66 |
|
| 67 |
(* Subtraction *) |
| 68 |
|
| 69 |
(* 100: 3.482 +/- 0.043 *) |
| 70 |
arith_test2d rep "data/nat10.txt" |
| 71 |
`(-):num->num->num` |
| 72 |
Arith_nat.raw_sub_hash_conv;; |
| 73 |
|
| 74 |
(* 100: 3.217 +/- 0.065 *) |
| 75 |
new_arith_test2d rep "data/nat10.txt" |
| 76 |
Nat_arith.nsub;; |
| 77 |
|
| 78 |
|
| 79 |
(* Multiplication *) |
| 80 |
|
| 81 |
(* 100: 36.875 +/- 0.184 *) |
| 82 |
arith_test2d rep "data/nat10.txt" |
| 83 |
`( * ):num->num->num` |
| 84 |
Arith_nat.raw_mul_conv_hash;; |
| 85 |
|
| 86 |
(* 100: 35.060 +/- 0.432 *) |
| 87 |
new_arith_test2d rep "data/nat10.txt" |
| 88 |
Nat_arith.nmul;; |
| 89 |
|
| 90 |
|
| 91 |
(* Division *) |
| 92 |
|
| 93 |
(* 100: +/- *) |
| 94 |
arith_test2d rep "data/nat10_small.txt" |
| 95 |
`DIV:num->num->num` |
| 96 |
Arith_nat.raw_div_hash_conv;; |
| 97 |
|
| 98 |
(* 100: +/- *) |
| 99 |
new_arith_test2d rep "data/nat10_small.txt" |
| 100 |
Nat_arith.ndiv;; |
| 101 |
|
| 102 |
show_result := true;; |
| 103 |
|
| 104 |
let data = read_file "data/nat8.txt";; |
| 105 |
|
| 106 |
let mk_arith_term = Arith_nat.mk_numeral_array;; |
| 107 |
|
| 108 |
let mk_new_arith_term = Nat_arith.mk_nat;; |
| 109 |
|