malachite-nz 0.10.0

The bignum types Natural and Integer, with efficient algorithms partially derived from GMP and FLINT.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
// Copyright © 2026 Mikhail Hogrefe
//
// This file is part of Malachite.
//
// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.

#![allow(
    unstable_name_collisions,
    clippy::bool_assert_comparison,
    clippy::assertions_on_constants,
    clippy::cognitive_complexity,
    clippy::excessive_precision,
    clippy::many_single_char_names,
    clippy::range_plus_one,
    clippy::suspicious_arithmetic_impl,
    clippy::suspicious_op_assign_impl,
    clippy::too_many_arguments,
    clippy::float_cmp,
    clippy::type_complexity,
    clippy::multiple_bound_locations
)]
#![warn(
    clippy::cast_lossless,
    clippy::comparison_chain,
    clippy::explicit_into_iter_loop,
    clippy::explicit_iter_loop,
    clippy::filter_map_next,
    clippy::large_digit_groups,
    clippy::manual_filter_map,
    clippy::manual_find_map,
    clippy::map_flatten,
    clippy::map_unwrap_or,
    clippy::match_same_arms,
    clippy::missing_const_for_fn,
    clippy::mut_mut,
    clippy::needless_borrow,
    clippy::needless_continue,
    clippy::needless_pass_by_value,
    clippy::option_if_let_else,
    clippy::print_stdout,
    clippy::redundant_closure_for_method_calls,
    clippy::single_match_else,
    clippy::trait_duplication_in_bounds,
    clippy::type_repetition_in_bounds,
    clippy::uninlined_format_args,
    clippy::unused_self,
    clippy::if_not_else,
    clippy::manual_assert,
    clippy::range_plus_one,
    clippy::redundant_else,
    clippy::semicolon_if_nothing_returned,
    clippy::cloned_instead_of_copied,
    clippy::flat_map_option,
    clippy::unnecessary_wraps,
    clippy::unnested_or_patterns,
    clippy::trivially_copy_pass_by_ref
)]

extern crate itertools;
#[macro_use]
extern crate malachite_base;
extern crate malachite_nz;
extern crate num;
extern crate rug;

pub mod integer {
    pub mod arithmetic {
        pub mod abs;
        pub mod abs_diff;
        pub mod add;
        pub mod add_mul;
        pub mod binomial_coefficient;
        pub mod div;
        pub mod div_euclidean;
        pub mod div_exact;
        pub mod div_mod;
        pub mod div_round;
        pub mod divisible_by;
        pub mod divisible_by_power_of_2;
        pub mod eq_mod;
        pub mod eq_mod_power_of_2;
        pub mod extended_gcd;
        pub mod kronecker_symbol;
        pub mod mod_op;
        pub mod mod_power_of_2;
        pub mod mul;
        pub mod neg;
        pub mod parity;
        pub mod pow;
        pub mod power_of_2;
        pub mod root;
        pub mod round_to_multiple;
        pub mod round_to_multiple_of_power_of_2;
        pub mod shl;
        pub mod shl_round;
        pub mod shr;
        pub mod shr_round;
        pub mod sign;
        pub mod sqrt;
        pub mod square;
        pub mod sub;
        pub mod sub_mul;
    }
    pub mod basic {
        pub mod constants;
        pub mod default;
        pub mod from_sign_and_abs;
        pub mod named;
        pub mod size;
    }
    pub mod comparison {
        pub mod cmp;
        pub mod cmp_abs;
        pub mod eq;
        pub mod eq_abs;
        pub mod eq_abs_natural;
        pub mod eq_abs_primitive_float;
        pub mod eq_abs_primitive_int;
        pub mod hash;
        pub mod partial_cmp_abs_natural;
        pub mod partial_cmp_abs_primitive_float;
        pub mod partial_cmp_abs_primitive_int;
        pub mod partial_cmp_natural;
        pub mod partial_cmp_primitive_float;
        pub mod partial_cmp_primitive_int;
        pub mod partial_eq_natural;
        pub mod partial_eq_primitive_float;
        pub mod partial_eq_primitive_int;
    }
    pub mod conversion {
        pub mod clone;
        pub mod from_bool;
        pub mod from_natural;
        pub mod from_primitive_float;
        pub mod from_primitive_int;
        pub mod from_twos_complement_limbs;
        pub mod is_integer;
        pub mod natural_from_integer;
        pub mod primitive_float_from_integer;
        pub mod primitive_int_from_integer;
        #[cfg(feature = "serde")]
        pub mod serde;
        pub mod string {
            pub mod from_sci_string;
            pub mod from_string;
            pub mod to_sci;
            pub mod to_string;
        }
        pub mod to_twos_complement_limbs;
    }
    pub mod exhaustive {
        pub mod exhaustive_integer_inclusive_range;
        pub mod exhaustive_integer_range;
        pub mod exhaustive_integer_range_to_infinity;
        pub mod exhaustive_integer_range_to_negative_infinity;
        pub mod exhaustive_integers;
        pub mod exhaustive_natural_integers;
        pub mod exhaustive_negative_integers;
        pub mod exhaustive_nonzero_integers;
        pub mod exhaustive_positive_integers;
        pub mod integer_decreasing_range_to_negative_infinity;
        pub mod integer_increasing_inclusive_range;
        pub mod integer_increasing_range;
        pub mod integer_increasing_range_to_infinity;
    }
    pub mod logic {
        pub mod and;
        pub mod assign_bit;
        pub mod assign_bits;
        pub mod bits;
        pub mod checked_count_ones;
        pub mod checked_count_zeros;
        pub mod checked_hamming_distance;
        pub mod clear_bit;
        pub mod flip_bit;
        pub mod from_bits;
        pub mod get_bit;
        pub mod get_bits;
        pub mod index_of_next_false_bit;
        pub mod index_of_next_true_bit;
        pub mod low_mask;
        pub mod not;
        pub mod or;
        pub mod set_bit;
        pub mod significant_bits;
        pub mod to_bits;
        pub mod trailing_zeros;
        pub mod xor;
    }
    pub mod random {
        pub mod get_random_integer_from_range_to_infinity;
        pub mod get_random_integer_from_range_to_negative_infinity;
        pub mod get_striped_random_integer_from_inclusive_range;
        pub mod get_striped_random_integer_from_range;
        pub mod get_striped_random_integer_from_range_to_infinity;
        pub mod get_striped_random_integer_from_range_to_negative_infinity;
        pub mod get_uniform_random_integer_from_inclusive_range;
        pub mod get_uniform_random_integer_from_range;
        pub mod random_integer_inclusive_range;
        pub mod random_integer_range;
        pub mod random_integer_range_to_infinity;
        pub mod random_integer_range_to_negative_infinity;
        pub mod random_integers;
        pub mod random_natural_integers;
        pub mod random_negative_integers;
        pub mod random_nonzero_integers;
        pub mod random_positive_integers;
        pub mod striped_random_integer_inclusive_range;
        pub mod striped_random_integer_range;
        pub mod striped_random_integer_range_to_infinity;
        pub mod striped_random_integer_range_to_negative_infinity;
        pub mod striped_random_integers;
        pub mod striped_random_natural_integers;
        pub mod striped_random_negative_integers;
        pub mod striped_random_nonzero_integers;
        pub mod striped_random_positive_integers;
        pub mod uniform_random_integer_inclusive_range;
        pub mod uniform_random_integer_range;
    }
}
pub mod natural {
    pub mod arithmetic {
        pub mod abs_diff;
        pub mod add;
        pub mod add_mul;
        pub mod binomial_coefficient;
        pub mod checked_sub;
        pub mod checked_sub_mul;
        pub mod coprime_with;
        pub mod div;
        pub mod div_euclidean;
        pub mod div_exact;
        pub mod div_mod;
        pub mod div_round;
        pub mod divisible_by;
        pub mod divisible_by_power_of_2;
        pub mod eq_mod;
        pub mod eq_mod_power_of_2;
        pub mod extended_gcd;
        pub mod factorial;
        #[cfg(feature = "float_helpers")]
        pub mod float_extras;
        pub mod gcd;
        pub mod is_power_of_2;
        pub mod kronecker_symbol;
        pub mod lcm;
        pub mod log_base;
        pub mod log_base_2;
        pub mod log_base_power_of_2;
        pub mod mod_add;
        pub mod mod_inverse;
        pub mod mod_is_reduced;
        pub mod mod_mul;
        pub mod mod_neg;
        pub mod mod_op;
        pub mod mod_pow;
        // end
        pub mod mod_power_of_2;
        pub mod mod_power_of_2_add;
        pub mod mod_power_of_2_inverse;
        pub mod mod_power_of_2_is_reduced;
        pub mod mod_power_of_2_mul;
        pub mod mod_power_of_2_neg;
        pub mod mod_power_of_2_pow;
        pub mod mod_power_of_2_shl;
        pub mod mod_power_of_2_shr;
        pub mod mod_power_of_2_square;
        pub mod mod_power_of_2_sub;
        pub mod mod_shl;
        pub mod mod_shr;
        pub mod mod_square;
        pub mod mod_sub;
        pub mod mul;
        pub mod neg;
        pub mod next_power_of_2;
        pub mod parity;
        pub mod pow;
        pub mod power_of_2;
        pub mod primorial;
        pub mod root;
        pub mod round_to_multiple;
        pub mod round_to_multiple_of_power_of_2;
        pub mod saturating_sub;
        pub mod saturating_sub_mul;
        pub mod shl;
        pub mod shl_round;
        pub mod shr;
        pub mod shr_round;
        pub mod sign;
        pub mod sqrt;
        pub mod square;
        pub mod sub;
        pub mod sub_mul;
    }
    pub mod basic {
        pub mod constants;
        pub mod default;
        pub mod named;
        pub mod size;
    }
    pub mod comparison {
        pub mod cmp;
        pub mod eq;
        pub mod eq_abs_primitive_float;
        pub mod eq_abs_primitive_int;
        pub mod hash;
        pub mod partial_cmp_abs_primitive_float;
        pub mod partial_cmp_abs_primitive_int;
        pub mod partial_cmp_primitive_float;
        pub mod partial_cmp_primitive_int;
        pub mod partial_eq_primitive_float;
        pub mod partial_eq_primitive_int;
    }
    pub mod conversion {
        pub mod clone;
        pub mod digits {
            pub mod from_digits;
            pub mod from_power_of_2_digits;
            pub mod power_of_2_digits;
            pub mod to_digits;
            pub mod to_power_of_2_digits;
        }
        pub mod from_bool;
        pub mod from_limbs;
        pub mod from_primitive_float;
        pub mod from_primitive_int;
        pub mod is_integer;
        pub mod mantissa_and_exponent {
            pub mod integer_mantissa_and_exponent;
            pub mod sci_mantissa_and_exponent;
        }
        pub mod primitive_float_from_natural;
        pub mod primitive_int_from_natural;
        #[cfg(feature = "serde")]
        pub mod serde;
        pub mod string {
            pub mod from_sci_string;
            pub mod from_string;
            pub mod to_sci;
            pub mod to_string;
        }
        pub mod to_limbs;
    }
    pub mod exhaustive {
        pub mod exhaustive_natural_inclusive_range;
        pub mod exhaustive_natural_range;
        pub mod exhaustive_natural_range_to_infinity;
        pub mod exhaustive_naturals;
        pub mod exhaustive_positive_naturals;
    }
    pub mod factorization {
        pub mod is_power;
        pub mod is_square;
        pub mod primes;
    }
    pub mod logic {
        pub mod and;
        pub mod assign_bit;
        pub mod assign_bits;
        pub mod bits;
        pub mod clear_bit;
        pub mod count_ones;
        pub mod flip_bit;
        pub mod from_bits;
        pub mod get_bit;
        pub mod get_bits;
        pub mod hamming_distance;
        pub mod index_of_next_false_bit;
        pub mod index_of_next_true_bit;
        pub mod limb_count;
        pub mod low_mask;
        pub mod not;
        pub mod or;
        pub mod set_bit;
        pub mod significant_bits;
        pub mod to_bits;
        pub mod trailing_zeros;
        pub mod xor;
    }
    pub mod random {
        pub mod get_random_natural_less_than;
        pub mod get_random_natural_with_bits;
        pub mod get_random_natural_with_up_to_bits;
        pub mod get_striped_random_natural_from_inclusive_range;
        pub mod get_striped_random_natural_from_range;
        pub mod get_striped_random_natural_with_bits;
        pub mod get_striped_random_natural_with_up_to_bits;
        pub mod random_natural_inclusive_range;
        pub mod random_natural_range;
        pub mod random_natural_range_to_infinity;
        pub mod random_naturals;
        pub mod random_naturals_less_than;
        pub mod random_positive_naturals;
        pub mod striped_random_natural_inclusive_range;
        pub mod striped_random_natural_range;
        pub mod striped_random_natural_range_to_infinity;
        pub mod striped_random_naturals;
        pub mod striped_random_positive_naturals;
        pub mod uniform_random_natural_inclusive_range;
        pub mod uniform_random_natural_range;
    }
}