equal
deleted
inserted
replaced
1167 val q = random_range 1 (i + 1); |
1167 val q = random_range 1 (i + 1); |
1168 val g = Integer.gcd p q; |
1168 val g = Integer.gcd p q; |
1169 val p' = p div g; |
1169 val p' = p div g; |
1170 val q' = q div g; |
1170 val q' = q div g; |
1171 val r = (if one_of [true, false] then p' else ~ p', |
1171 val r = (if one_of [true, false] then p' else ~ p', |
1172 if p' = 0 then 0 else q') |
1172 if p' = 0 then 1 else q') |
1173 in |
1173 in |
1174 (r, fn () => term_of_real r) |
1174 (r, fn () => term_of_real r) |
1175 end; |
1175 end; |
1176 *} |
1176 *} |
1177 |
1177 |
1179 Ratreal ("(_)") |
1179 Ratreal ("(_)") |
1180 |
1180 |
1181 consts_code |
1181 consts_code |
1182 "of_int :: int \<Rightarrow> real" ("\<module>real'_of'_int") |
1182 "of_int :: int \<Rightarrow> real" ("\<module>real'_of'_int") |
1183 attach {* |
1183 attach {* |
1184 fun real_of_int 0 = (0, 0) |
1184 fun real_of_int i = (i, 1); |
1185 | real_of_int i = (i, 1); |
|
1186 *} |
1185 *} |
1187 |
1186 |
1188 end |
1187 end |