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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
/// Addition of [`Natural`](super::Natural)s.
pub mod add;
/// Implementations of [`AddMul`](malachite_base::num::arithmetic::traits::AddMul) and
/// [`AddMulAssign`](malachite_base::num::arithmetic::traits::AddMulAssign), traits for adding a
/// number and the product of two other numbers.
pub mod add_mul;
/// Implementations of [`CheckedSub`](malachite_base::num::arithmetic::traits::CheckedSub), a trait
/// for subtracting two numbers and checking whether the result is representable.
pub mod checked_sub;
/// Implementations of [`CheckedSubMul`](malachite_base::num::arithmetic::traits::CheckedSubMul), a
/// trait for subtracting the product of two numbers from another number, and checking whether the
/// result is representable.
pub mod checked_sub_mul;
/// Implementations of [`CoprimeWith`](malachite_base::num::arithmetic::traits::CoprimeWith), a
/// trait for determining whether two numbers are coprime.
pub mod coprime_with;
/// Division of [`Natural`](super::Natural)s.
pub mod div;
/// Implementations of [`DivExact`](malachite_base::num::arithmetic::traits::DivExact) and
/// [`DivExactAssign`](malachite_base::num::arithmetic::traits::DivExactAssign), traits for
/// dividing two numbers when it's known that the division is exact.
pub mod div_exact;
/// Implementations of raits for simultaneously finding the quotient and remainder of two numbers,
/// subject to various rounding rules.
///
/// These are the traits:
///
/// | rounding     | by value or reference           | by mutable reference (assignment)      |
/// |--------------|---------------------------------|----------------------------------------|
/// | towards $-\infty$ | [`DivMod`](malachite_base::num::arithmetic::traits::DivMod) | [`DivAssignMod`](malachite_base::num::arithmetic::traits::DivAssignMod) |
/// | towards 0         | [`DivRem`](malachite_base::num::arithmetic::traits::DivRem) | [`DivAssignRem`](malachite_base::num::arithmetic::traits::DivAssignRem) |
/// | towards $\infty$  | [`CeilingDivNegMod`](malachite_base::num::arithmetic::traits::CeilingDivNegMod) | [`CeilingDivAssignNegMod`](malachite_base::num::arithmetic::traits::CeilingDivAssignNegMod) |
///
/// [`CeilingDivNegMod`](malachite_base::num::arithmetic::traits::CeilingDivNegMod) returns a
/// remainder greater than or equal to zero. This allows the remainder to have an unsigned type,
/// but modifies the usual relation $x = qy + r$ to $x = qy - r$.
pub mod div_mod;
/// Implementations of [`DivRound`](malachite_base::num::arithmetic::traits::DivRound) and
/// [`DivExactAssign`](malachite_base::num::arithmetic::traits::DivRoundAssign), traits for
/// dividing two numbers according to a specified
/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode).
pub mod div_round;
/// Implementations of [`DivisibleBy`](malachite_base::num::arithmetic::traits::DivisibleBy), a
/// trait for determining whether one number is divisible by another.
pub mod divisible_by;
/// Implementations of
/// [`DivisibleByPowerOf2`](malachite_base::num::arithmetic::traits::DivisibleByPowerOf2), a trait
/// for determining whether a number
/// is divisible by $2^k$.
pub mod divisible_by_power_of_2;
/// Implementations of [`EqMod`](malachite_base::num::arithmetic::traits::EqMod), a trait for
/// determining whether one number is equal by another modulo a third.
pub mod eq_mod;
/// Implementations of [`EqModPowerOf2`](malachite_base::num::arithmetic::traits::EqModPowerOf2),
/// a trait for determining whether one number is equal to another modulo $2^k$.
pub mod eq_mod_power_of_2;
/// Implementations of [`Gcd`](malachite_base::num::arithmetic::traits::Gcd) and
/// [`GcdAssign`](malachite_base::num::arithmetic::traits::GcdAssign), traits for computing the GCD
/// (greatest common divisor) of two numbers.
pub mod gcd;
/// Implementations of [`IsPowerOf2`](malachite_base::num::arithmetic::traits::IsPowerOf2), a trait
/// for determining whether a number is an integer power of 2.
pub mod is_power_of_2;
/// Implementations of [`Lcm`](malachite_base::num::arithmetic::traits::Lcm),
/// [`LcmAssign`](malachite_base::num::arithmetic::traits::LcmAssign), and
/// [`CheckedLcm`](malachite_base::num::arithmetic::traits::CheckedLcm), traits for computing the
/// LCM (least common multiple) of two numbers.
pub mod lcm;
/// Implementations of traits for taking the base-$b$ logarithm of a number.
///
/// The traits are [`FloorLogBase`](malachite_base::num::arithmetic::traits::FloorLogBase),
/// [`CeilingLogBase`](malachite_base::num::arithmetic::traits::CeilingLogBase), and
/// [`CheckedLogBase`](malachite_base::num::arithmetic::traits::CheckedLogBase).
pub mod log_base;
/// Implementations of traits for taking the base-2 logarithm of a number.
///
/// The traits are [`FloorLogBase2`](malachite_base::num::arithmetic::traits::FloorLogBase2),
/// [`CeilingLogBase2`](malachite_base::num::arithmetic::traits::CeilingLogBase2), and
/// [`CheckedLogBase2`](malachite_base::num::arithmetic::traits::CheckedLogBase2).
pub mod log_base_2;
/// Implementations of traits for taking the base-$2^k$ logarithm of a number.
///
/// The traits are
/// [`FloorLogBasePowerOf2`](malachite_base::num::arithmetic::traits::FloorLogBasePowerOf2),
/// [`CeilingLogBasePowerOf2`](malachite_base::num::arithmetic::traits::CeilingLogBasePowerOf2),
/// and
/// [`CheckedLogBasePowerOf2`](malachite_base::num::arithmetic::traits::CheckedLogBasePowerOf2).
pub mod log_base_power_of_2;
/// Implementations of [`ModAdd`](malachite_base::num::arithmetic::traits::ModAdd) and
/// [`ModAddAssign`](malachite_base::num::arithmetic::traits::ModAddAssign), traits for adding two
/// numbers modulo another number.
pub mod mod_add;
/// Implementations of [`ModIsReduced`](malachite_base::num::arithmetic::traits::ModIsReduced), a
/// trait for checking whether a number is reduced modulo another number.
pub mod mod_is_reduced;
/// Implementations of traits for multiplying two numbers modulo another number.
///
/// The traits are [`ModMul`](malachite_base::num::arithmetic::traits::ModMul),
/// [`ModMulAssign`](malachite_base::num::arithmetic::traits::ModMulAssign),
/// [`ModMulPrecomputed`](malachite_base::num::arithmetic::traits::ModMulPrecomputed), and
/// [`ModMulPrecomputedAssign`](malachite_base::num::arithmetic::traits::ModMulPrecomputedAssign).
/// [`ModMulPrecomputed`](malachite_base::num::arithmetic::traits::ModMulPrecomputed) and
/// [`ModMulPrecomputedAssign`](malachite_base::num::arithmetic::traits::ModMulPrecomputedAssign)
/// are useful when having to make several multiplications modulo the same modulus.
pub mod mod_mul;
/// Implementations of [`ModNeg`](malachite_base::num::arithmetic::traits::ModNeg) and
/// [`ModNegAssign`](malachite_base::num::arithmetic::traits::ModNegAssign), traits for negating a
/// number modulo another number.
pub mod mod_neg;
/// Implementations of traits for finding the remainder of two numbers, subject to various rounding
/// rules.
///
/// These are the traits:
///
/// | rounding          | by value or reference      | by mutable reference (assignment)      |
/// |-------------------|----------------------------|----------------------------------------|
/// | towards $-\infty$ | [`Mod`](malachite_base::num::arithmetic::traits::Mod)       | [`ModAssign`](malachite_base::num::arithmetic::traits::ModAssign)       |
/// | towards $\infty$  | [`NegMod`](malachite_base::num::arithmetic::traits::NegMod) | [`NegModAssign`](malachite_base::num::arithmetic::traits::NegModAssign) |
///
/// [`NegMod`](malachite_base::num::arithmetic::traits::NegMod) returns a remainder greater than or
/// equal to zero. This allows the remainder to have an unsigned type, but modifies the usual
/// relation $x = qy + r$ to $x = qy - r$.
///
/// The [`Rem`](std::ops::Rem) trait in the standard library rounds towards 0.
pub mod mod_op;
/// Implementations of traits for raising a number to a power modulo another number.
///
/// The traits are [`ModPow`](malachite_base::num::arithmetic::traits::ModPow),
/// [`ModPowAssign`](malachite_base::num::arithmetic::traits::ModPowAssign), and
/// [`ModPowPrecomputed`](malachite_base::num::arithmetic::traits::ModPowPrecomputed).
/// [`ModPowPrecomputed`](malachite_base::num::arithmetic::traits::ModPowPrecomputed) is useful
/// when having to make several exponentiations modulo the same modulus.
pub mod mod_pow;
/// Implementations of traits for finding the remainder of a number divided by $2^k$, subject to
/// various rounding rules.
///
/// These are the traits:
///
/// | rounding | by value or reference | by mutable reference (assignment) |
/// |----------|-----------------------|-----------------------------------|
/// | towards $-\infty$ | [`ModPowerOf2`](malachite_base::num::arithmetic::traits::ModPowerOf2) | [`ModPowerOf2Assign`](malachite_base::num::arithmetic::traits::ModPowerOf2Assign)       |
/// | towards 0 | [`RemPowerOf2`](malachite_base::num::arithmetic::traits::RemPowerOf2) | [`RemPowerOf2Assign`](malachite_base::num::arithmetic::traits::RemPowerOf2Assign)       |
/// | towards $\infty$  | [`NegModPowerOf2`](malachite_base::num::arithmetic::traits::NegModPowerOf2) | [`NegModPowerOf2Assign`](malachite_base::num::arithmetic::traits::NegModPowerOf2Assign) |
///
/// [`NegModPowerOf2`](malachite_base::num::arithmetic::traits::NegModPowerOf2) returns a remainder
/// greater than or equal to zero. This allows the remainder to have an unsigned type, but modifies
/// the usual relation $x = q2^k + r$ to $x = q2^k - r$.
pub mod mod_power_of_2;
/// Implementations of [`ModPowerOf2Add`](malachite_base::num::arithmetic::traits::ModPowerOf2Add)
/// and [`ModPowerOf2AddAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2AddAssign),
/// traits for adding two numbers modulo $2^k$.
pub mod mod_power_of_2_add;
/// Implementations of
/// [`ModPowerOf2IsReduced`](malachite_base::num::arithmetic::traits::ModPowerOf2IsReduced), a
/// trait for checking whether a number is reduced modulo $2^k$.
pub mod mod_power_of_2_is_reduced;
/// Implementations of [`ModPowerOf2Mul`](malachite_base::num::arithmetic::traits::ModPowerOf2Mul)
/// and [`ModPowerOf2MulAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2MulAssign),
/// traits for multiplying two numbers modulo $2^k$.
pub mod mod_power_of_2_mul;
/// Implementations of [`ModPowerOf2Neg`](malachite_base::num::arithmetic::traits::ModPowerOf2Neg)
/// and [`ModPowerOf2NegAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2NegAssign),
/// traits for negating a number modulo $2^k$.
pub mod mod_power_of_2_neg;
/// Implementations of [`ModPowerOf2Pow`](malachite_base::num::arithmetic::traits::ModPowerOf2Pow)
/// and [`ModPowerOf2PowAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2PowAssign),
/// traits for raising a number to a power modulo $2^k$.
pub mod mod_power_of_2_pow;
/// Implementations of [`ModPowerOf2Shl`](malachite_base::num::arithmetic::traits::ModPowerOf2Shl)
/// and [`ModPowerOf2ShlAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2ShlAssign),
/// traits for left-shifting a number modulo $2^k$.
///
/// # mod_power_of_2_shl
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::ModPowerOf2Shl;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shl(5u16, 8), 96);
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shl(100u64, 80), 0);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shl(5u16, 8), 96);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shl(100u64, 80), 0);
///
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shl(5i16, 8), 96);
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shl(100i64, 80), 0);
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shl(-2i8, 8), 30);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shl(5i16, 8), 96);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shl(100i64, 80), 0);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shl(-2i8, 8), 30);
/// ```
///
/// # mod_power_of_2_shl_assign
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::ModPowerOf2ShlAssign;
/// use malachite_nz::natural::Natural;
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shl_assign(5u16, 8);
/// assert_eq!(n, 96);
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shl_assign(100u64, 80);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shl_assign(5i16, 8);
/// assert_eq!(n, 96);
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shl_assign(100i64, 80);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shl_assign(-2i8, 8);
/// assert_eq!(n, 30);
/// ```
pub mod mod_power_of_2_shl;
/// Implementations of [`ModPowerOf2Shr`](malachite_base::num::arithmetic::traits::ModPowerOf2Shr)
/// and [`ModPowerOf2ShrAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2ShrAssign),
/// traits for right-shifting a number modulo $2^k$.
///
/// # mod_power_of_2_shr
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::ModPowerOf2Shr;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shr(-5i16, 8), 96);
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shr(-100i64, 80), 0);
/// assert_eq!(Natural::from(123u32).mod_power_of_2_shr(2i8, 8), 30);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shr(-5i16, 8), 96);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shr(-100i64, 80), 0);
/// assert_eq!((&Natural::from(123u32)).mod_power_of_2_shr(2i8, 8), 30);
/// ```
///
/// # mod_power_of_2_shr_assign
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::ModPowerOf2ShrAssign;
/// use malachite_nz::natural::Natural;
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shr_assign(-5i16, 8);
/// assert_eq!(n, 96);
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shr_assign(-100i64, 80);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(123u32);
/// n.mod_power_of_2_shr_assign(2i8, 8);
/// assert_eq!(n, 30);
/// ```
pub mod mod_power_of_2_shr;
/// Implementations of
/// `ModPowerOf2Square`](malachite_base::num::arithmetic::traits::ModPowerOf2Square) and
/// [`ModPowerOf2SquareAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2SquareAssign),
/// traits for squaring a number modulo $2^k$.
pub mod mod_power_of_2_square;
/// Implementations of [`ModPowerOf2Sub`](malachite_base::num::arithmetic::traits::ModPowerOf2Sub)
/// and [`ModPowerOf2SubAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2SubAssign),
/// traits for subtracting one number by another modulo $2^k$.
pub mod mod_power_of_2_sub;
/// Implementations of [`ModShl`](malachite_base::num::arithmetic::traits::ModShl) and
/// [`ModShlAssign`](malachite_base::num::arithmetic::traits::ModShlAssign), traits for
/// left-shifting a number modulo another number.
///
/// # mod_shl
/// ```
/// extern crate malachite_base;
///
/// use std::str::FromStr;
/// use malachite_base::num::arithmetic::traits::ModShl;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!(Natural::from(8u32).mod_shl(2u16, Natural::from(10u32)), 2);
/// assert_eq!(
///     Natural::from(123456u32).mod_shl(100u64, Natural::from_str("12345678987654321").unwrap()),
///     7436663564915145u64
/// );
/// assert_eq!(Natural::from(8u32).mod_shl(2u16, &Natural::from(10u32)), 2);
/// assert_eq!(
///     Natural::from(123456u32).mod_shl(100u64, &Natural::from_str("12345678987654321").unwrap()),
///     7436663564915145u64
/// );
/// assert_eq!((&Natural::from(8u32)).mod_shl(2u16, Natural::from(10u32)), 2);
/// assert_eq!(
///     (&Natural::from(123456u32)).mod_shl(
///         100u64,
///         Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// assert_eq!((&Natural::from(8u32)).mod_shl(2u16, &Natural::from(10u32)), 2);
/// assert_eq!(
///     (&Natural::from(123456u32)).mod_shl(
///         100u64,
///         &Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
///
/// assert_eq!(Natural::from(8u32).mod_shl(2i8, Natural::from(10u32)), 2);
/// assert_eq!(Natural::from(10u32).mod_shl(-100i32, Natural::from(10u32)), 0);
/// assert_eq!(
///     Natural::from(123456u32).mod_shl(100i64, Natural::from_str("12345678987654321").unwrap()),
///     7436663564915145u64
/// );
/// assert_eq!(Natural::from(8u32).mod_shl(2i8, &Natural::from(10u32)), 2);
/// assert_eq!(Natural::from(10u32).mod_shl(-100i32, &Natural::from(10u32)), 0);
/// assert_eq!(
///     Natural::from(123456u32).mod_shl(
///         100i64,
///         &Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// assert_eq!((&Natural::from(8u32)).mod_shl(2i8, Natural::from(10u32)), 2);
/// assert_eq!((&Natural::from(10u32)).mod_shl(-100i32, Natural::from(10u32)), 0);
/// assert_eq!(
///     (&Natural::from(123456u32)).mod_shl(
///         100i64,
///         Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// assert_eq!((&Natural::from(8u32)).mod_shl(2i8, &Natural::from(10u32)), 2);
/// assert_eq!((&Natural::from(10u32)).mod_shl(-100i32, &Natural::from(10u32)), 0);
/// assert_eq!(
///     (&Natural::from(123456u32)).mod_shl(
///         100i64,
///         &Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// ```
///
/// # mod_shl_assign
/// ```
/// extern crate malachite_base;
///
/// use std::str::FromStr;
/// use malachite_base::num::arithmetic::traits::ModShlAssign;
/// use malachite_nz::natural::Natural;
///
/// let mut x = Natural::from(8u32);
/// x.mod_shl_assign(2u16, Natural::from(10u32));
/// assert_eq!(x, 2);
///
/// let mut x = Natural::from(123456u32);
/// x.mod_shl_assign(100u64, Natural::from_str("12345678987654321").unwrap());
/// assert_eq!(x, 7436663564915145u64);
///
/// let mut x = Natural::from(8u32);
/// x.mod_shl_assign(2u16, &Natural::from(10u32));
/// assert_eq!(x, 2);
///
/// let mut x = Natural::from(123456u32);
/// x.mod_shl_assign(100u64, &Natural::from_str("12345678987654321").unwrap());
/// assert_eq!(x, 7436663564915145u64);
///
/// let mut x = Natural::from(8u32);
/// x.mod_shl_assign(2i8, Natural::from(10u32));
/// assert_eq!(x, 2);
///
/// let mut x = Natural::from(10u32);
/// x.mod_shl_assign(-100i32, Natural::from(10u32));
/// assert_eq!(x, 0);
///
/// let mut x = Natural::from(123456u32);
/// x.mod_shl_assign(100i64, Natural::from_str("12345678987654321").unwrap());
/// assert_eq!(x, 7436663564915145u64);
///
/// let mut x = Natural::from(8u32);
/// x.mod_shl_assign(2i8, &Natural::from(10u32));
/// assert_eq!(x, 2);
///
/// let mut x = Natural::from(10u32);
/// x.mod_shl_assign(-100i32, &Natural::from(10u32));
/// assert_eq!(x, 0);
///
/// let mut x = Natural::from(123456u32);
/// x.mod_shl_assign(100i64, &Natural::from_str("12345678987654321").unwrap());
/// assert_eq!(x, 7436663564915145u64);
/// ```
pub mod mod_shl;
/// Implementations of [`ModShr`](malachite_base::num::arithmetic::traits::ModShr) and
/// [`ModShrAssign`](malachite_base::num::arithmetic::traits::ModShrAssign), traits for
/// right-shifting a number modulo another number.
///
/// # mod_shr
/// ```
/// extern crate malachite_base;
///
/// use std::str::FromStr;
/// use malachite_base::num::arithmetic::traits::ModShr;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!(Natural::from(8u32).mod_shr(-2i8, Natural::from(10u32)), 2);
/// assert_eq!(Natural::from(10u32).mod_shr(100i32, Natural::from(10u32)), 0);
/// assert_eq!(
///     Natural::from(123456u32).mod_shr(
///         -100i64,
///         Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// assert_eq!(Natural::from(8u32).mod_shr(-2i8, &Natural::from(10u32)), 2);
/// assert_eq!(Natural::from(10u32).mod_shr(100i32, &Natural::from(10u32)), 0);
/// assert_eq!(
///     Natural::from(123456u32).mod_shr(
///         -100i64,
///         &Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// assert_eq!((&Natural::from(8u32)).mod_shr(-2i8, Natural::from(10u32)), 2);
/// assert_eq!((&Natural::from(10u32)).mod_shr(100i32, Natural::from(10u32)), 0);
/// assert_eq!(
///     (&Natural::from(123456u32)).mod_shr(
///         -100i64,
///         Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// assert_eq!((&Natural::from(8u32)).mod_shr(-2i8, &Natural::from(10u32)), 2);
/// assert_eq!((&Natural::from(10u32)).mod_shr(100i32, &Natural::from(10u32)), 0);
/// assert_eq!(
///     (&Natural::from(123456u32)).mod_shr(
///         -100i64,
///         &Natural::from_str("12345678987654321").unwrap()
///     ),
///     7436663564915145u64
/// );
/// ```
///
/// # mod_shr_assign
/// ```
/// extern crate malachite_base;
///
/// use std::str::FromStr;
/// use malachite_base::num::arithmetic::traits::ModShrAssign;
/// use malachite_nz::natural::Natural;
///
/// let mut x = Natural::from(8u32);
/// x.mod_shr_assign(-2i8, Natural::from(10u32));
/// assert_eq!(x, 2);
///
/// let mut x = Natural::from(10u32);
/// x.mod_shr_assign(100i32, Natural::from(10u32));
/// assert_eq!(x, 0);
///
/// let mut x = Natural::from(123456u32);
/// x.mod_shr_assign(-100i64, Natural::from_str("12345678987654321").unwrap());
/// assert_eq!(x, 7436663564915145u64);
///
/// let mut x = Natural::from(8u32);
/// x.mod_shr_assign(-2i8, &Natural::from(10u32));
/// assert_eq!(x, 2);
///
/// let mut x = Natural::from(10u32);
/// x.mod_shr_assign(100i32, &Natural::from(10u32));
/// assert_eq!(x, 0);
///
/// let mut x = Natural::from(123456u32);
/// x.mod_shr_assign(-100i64, &Natural::from_str("12345678987654321").unwrap());
/// assert_eq!(x, 7436663564915145u64);
/// ```
pub mod mod_shr;
/// Implementations of traits for squaring a number modulo another number.
///
/// The traits are [`ModSquare`](malachite_base::num::arithmetic::traits::ModSquare),
/// [`ModSquareAssign`](malachite_base::num::arithmetic::traits::ModSquareAssign),
/// and [`ModSquarePrecomputed`](malachite_base::num::arithmetic::traits::ModSquarePrecomputed).
/// [`ModSquarePrecomputed`](malachite_base::num::arithmetic::traits::ModSquarePrecomputed) is
/// useful when having to make several squarings modulo the same modulus.
pub mod mod_square;
/// Implementations of [`ModSub`](malachite_base::num::arithmetic::traits::ModSub) and
/// [`ModSubAssign`](malachite_base::num::arithmetic::traits::ModSubAssign), traits for subtracting
/// two numbers modulo another number.
pub mod mod_sub;
/// Multiplication of [`Natural`](super::Natural)s.
pub mod mul;
/// Negation of a [`Natural`](super::Natural), returning an [`Integer`](crate::integer::Integer).
pub mod neg;
/// Implementations of [`NextPowerOf2`](malachite_base::num::arithmetic::traits::NextPowerOf2) and
/// [`NextPowerOf2Assign`](malachite_base::num::arithmetic::traits::NextPowerOf2Assign), traits for
/// getting the next-highest power of 2.
pub mod next_power_of_2;
/// Implementations of [`Parity`](malachite_base::num::arithmetic::traits::Parity), a trait for
/// determining whether a number is even or odd.
pub mod parity;
/// Implementations of [`Pow`](malachite_base::num::arithmetic::traits::Pow) and
/// [`PowAssign`](malachite_base::num::arithmetic::traits::PowAssign), traits for raising a number
/// to a power.
pub mod pow;
/// Implementations of [`PowerOf2`](malachite_base::num::arithmetic::traits::PowerOf2), a trait for
/// computing a power of 2.
pub mod power_of_2;
/// Implementations of traits for taking the $n$th root of a number.
///
/// The traits are [`FloorRoot`](malachite_base::num::arithmetic::traits::FloorRoot),
/// [`FloorRootAssign`](malachite_base::num::arithmetic::traits::FloorRootAssign),
/// [`CeilingRoot`](malachite_base::num::arithmetic::traits::CeilingRoot),
/// [`CeilingRootAssign`](malachite_base::num::arithmetic::traits::CeilingRootAssign),
/// [`CheckedRoot`](malachite_base::num::arithmetic::traits::CheckedRoot),
/// [`RootRem`](malachite_base::num::arithmetic::traits::RootRem), and
/// [`RootAssignRem`](malachite_base::num::arithmetic::traits::RootAssignRem).
pub mod root;
/// Implementations of
/// [`RoundToMultiple`](malachite_base::num::arithmetic::traits::RoundToMultiple) and
/// [`RoundToMultipleAssign`](malachite_base::num::arithmetic::traits::RoundToMultipleAssign),
/// traits for rounding a number to a multiple of another number.
pub mod round_to_multiple;
/// Implementations of
/// [`RoundToMultipleOfPowerOf2`](malachite_base::num::arithmetic::traits::RoundToMultipleOfPowerOf2)
/// and
/// [`RoundToMultipleOfPowerOf2Assign`](malachite_base::num::arithmetic::traits::RoundToMultipleOfPowerOf2Assign),
/// traits for rounding a number to a multiple of a power of 2.
pub mod round_to_multiple_of_power_of_2;
/// Implementations of [`SaturatingSub`](malachite_base::num::arithmetic::traits::SaturatingSub)
/// and [`SaturatingSubAssign`](malachite_base::num::arithmetic::traits::SaturatingSubAssign),
/// traits for subtracting two numbers and saturating at numeric bounds instead of overflowing.
pub mod saturating_sub;
/// Implementations of
/// [`SaturatingSubMul`](malachite_base::num::arithmetic::traits::SaturatingSubMul) and
/// [`SaturatingSubMulAssign`](malachite_base::num::arithmetic::traits::SaturatingSubMulAssign),
/// traits for subtracting a number by the product of two numbers and saturating at numeric bounds
/// instead of overflowing.
pub mod saturating_sub_mul;
/// Left-shifting a [`Natural`](super::Natural) (multiplying it by a power of 2).
///
/// # shl
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::Pow;
/// use malachite_base::num::basic::traits::Zero;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!((Natural::ZERO << 10u8), 0);
/// assert_eq!((Natural::from(123u32) << 2u16), 492);
/// assert_eq!((Natural::from(123u32) << 100u64).to_string(), "155921023828072216384094494261248");
/// assert_eq!((&Natural::ZERO << 10u8), 0);
/// assert_eq!((&Natural::from(123u32) << 2u16), 492);
/// assert_eq!(
///     (&Natural::from(123u32) << 100u64).to_string(),
///     "155921023828072216384094494261248"
/// );
///
/// assert_eq!((Natural::ZERO << 10i8), 0);
/// assert_eq!((Natural::from(123u32) << 2i16), 492);
/// assert_eq!((Natural::from(123u32) << 100i32).to_string(), "155921023828072216384094494261248");
/// assert_eq!((Natural::ZERO << -10i64), 0);
/// assert_eq!((Natural::from(10u32).pow(12) << -10i16), 976562500);
/// assert_eq!((&Natural::ZERO << 10i8), 0);
/// assert_eq!((&Natural::from(123u32) << 2i16), 492);
/// assert_eq!(
///     (&Natural::from(123u32) << 100i32).to_string(),
///     "155921023828072216384094494261248"
/// );
/// assert_eq!((&Natural::ZERO << -10i64), 0);
/// assert_eq!((&Natural::from(492u32) << -2i8), 123);
/// assert_eq!((&Natural::from(10u32).pow(12) << -10i16), 976562500);
/// ```
///
/// # shl_assign
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::basic::traits::One;
/// use malachite_nz::natural::Natural;
///
/// let mut x = Natural::ONE;
/// x <<= 1u8;
/// x <<= 2u16;
/// x <<= 3u32;
/// x <<= 4u64;
/// assert_eq!(x, 1024);
///
/// let mut x = Natural::ONE;
/// x <<= 1i8;
/// x <<= 2i16;
/// x <<= 3i32;
/// x <<= 4i64;
/// assert_eq!(x, 1024);
///
/// let mut x = Natural::from(1024u32);
/// x <<= -1i8;
/// x <<= -2i16;
/// x <<= -3i32;
/// x <<= -4i64;
/// assert_eq!(x, 1);
/// ```
pub mod shl;
/// Implementations of [`ShlRound`](malachite_base::num::arithmetic::traits::ShlRound) and
/// [`ShlRoundAssign`](malachite_base::num::arithmetic::traits::ShlRoundAssign), traits for
/// multiplying a number by a power of 2 and rounding according to a specified
/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode).
///
/// # shl_round
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::rounding_modes::RoundingMode;
/// use malachite_base::num::arithmetic::traits::ShlRound;
/// use malachite_base::num::basic::traits::Zero;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!(Natural::from(0x101u32).shl_round(-8i8, RoundingMode::Down), 1);
/// assert_eq!(Natural::from(0x101u32).shl_round(-8i16, RoundingMode::Up), 2);
/// assert_eq!(Natural::from(0x101u32).shl_round(-9i32, RoundingMode::Down), 0);
/// assert_eq!(Natural::from(0x101u32).shl_round(-9i64, RoundingMode::Up), 1);
/// assert_eq!(Natural::from(0x101u32).shl_round(-9i8, RoundingMode::Nearest), 1);
/// assert_eq!(Natural::from(0xffu32).shl_round(-9i16, RoundingMode::Nearest), 0);
/// assert_eq!(Natural::from(0x100u32).shl_round(-9i32, RoundingMode::Nearest), 0);
/// assert_eq!(Natural::from(0x100u32).shl_round(-8i64, RoundingMode::Exact), 1);
/// assert_eq!(Natural::ZERO.shl_round(10i8, RoundingMode::Exact), 0);
/// assert_eq!(Natural::from(123u32).shl_round(2i16, RoundingMode::Exact), 492);
/// assert_eq!(
///     Natural::from(123u32).shl_round(100i32, RoundingMode::Exact).to_string(),
///     "155921023828072216384094494261248"
/// );
///
/// assert_eq!((&Natural::from(0x101u32)).shl_round(-8i8, RoundingMode::Down), 1);
/// assert_eq!((&Natural::from(0x101u32)).shl_round(-8i16, RoundingMode::Up), 2);
/// assert_eq!((&Natural::from(0x101u32)).shl_round(-9i32, RoundingMode::Down), 0);
/// assert_eq!((&Natural::from(0x101u32)).shl_round(-9i64, RoundingMode::Up), 1);
/// assert_eq!((&Natural::from(0x101u32)).shl_round(-9i8, RoundingMode::Nearest), 1);
/// assert_eq!((&Natural::from(0xffu32)).shl_round(-9i16, RoundingMode::Nearest), 0);
/// assert_eq!((&Natural::from(0x100u32)).shl_round(-9i32, RoundingMode::Nearest), 0);
/// assert_eq!((&Natural::from(0x100u32)).shl_round(-8i64, RoundingMode::Exact), 1);
/// assert_eq!((&Natural::ZERO).shl_round(10i8, RoundingMode::Exact), 0);
/// assert_eq!((&Natural::from(123u32)).shl_round(2i16, RoundingMode::Exact), 492);
/// assert_eq!(
///     (&Natural::from(123u32)).shl_round(100i32, RoundingMode::Exact).to_string(),
///     "155921023828072216384094494261248"
/// );
/// ```
///
/// # shl_round_assign
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::rounding_modes::RoundingMode;
/// use malachite_base::num::arithmetic::traits::ShlRoundAssign;
/// use malachite_base::num::basic::traits::One;
/// use malachite_nz::natural::Natural;
///
/// let mut n = Natural::from(0x101u32);
/// n.shl_round_assign(-8i8, RoundingMode::Down);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shl_round_assign(-8i16, RoundingMode::Up);
/// assert_eq!(n, 2);
///
/// let mut n = Natural::from(0x101u32);
/// n.shl_round_assign(-9i32, RoundingMode::Down);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x101u32);
/// n.shl_round_assign(-9i64, RoundingMode::Up);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shl_round_assign(-9i8, RoundingMode::Nearest);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0xffu32);
/// n.shl_round_assign(-9i16, RoundingMode::Nearest);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x100u32);
/// n.shl_round_assign(-9i32, RoundingMode::Nearest);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x100u32);
/// n.shl_round_assign(-8i64, RoundingMode::Exact);
/// assert_eq!(n, 1);
///
/// let mut x = Natural::ONE;
/// x.shl_round_assign(1i8, RoundingMode::Exact);
/// x.shl_round_assign(2i16, RoundingMode::Exact);
/// x.shl_round_assign(3i32, RoundingMode::Exact);
/// x.shl_round_assign(4i64, RoundingMode::Exact);
/// assert_eq!(x, 1024);
/// ```
pub mod shl_round;
/// Right-shifting a [`Natural`](super::Natural) (dividing it by a power of 2).
///
/// # shr
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::Pow;
/// use malachite_base::num::basic::traits::Zero;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!((Natural::ZERO >> 10u8), 0);
/// assert_eq!((Natural::from(492u32) >> 2u32), 123);
/// assert_eq!((Natural::from(10u32).pow(12) >> 10u64), 976562500);
/// assert_eq!((&Natural::ZERO >> 10u8), 0);
/// assert_eq!((&Natural::from(492u32) >> 2u32), 123);
/// assert_eq!((&Natural::from(10u32).pow(12) >> 10u64), 976562500);
///
/// assert_eq!((Natural::ZERO >> 10i8), 0);
/// assert_eq!((Natural::from(492u32) >> 2i16), 123);
/// assert_eq!((Natural::from(10u32).pow(12) >> 10i32), 976562500);
/// assert_eq!((Natural::ZERO >> -10i64), 0);
/// assert_eq!((Natural::from(123u32) >> -2i8), 492);
/// assert_eq!(
///     (Natural::from(123u32) >> -100i16).to_string(),
///     "155921023828072216384094494261248"
/// );
/// assert_eq!((&Natural::ZERO >> -10i8), 0);
/// assert_eq!((&Natural::from(123u32) >> -2i16), 492);
/// assert_eq!(
///     (&Natural::from(123u32) >> -100i32).to_string(),
///     "155921023828072216384094494261248"
/// );
/// assert_eq!((&Natural::ZERO >> 10i64), 0);
/// assert_eq!((&Natural::from(492u32) >> 2i8), 123);
/// assert_eq!((&Natural::from(10u32).pow(12) >> 10i16), 976562500);
/// ```
///
/// # shr_assign
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::basic::traits::One;
/// use malachite_nz::natural::Natural;
///
/// let mut x = Natural::from(1024u32);
/// x >>= 1u8;
/// x >>= 2u16;
/// x >>= 3u32;
/// x >>= 4u64;
/// assert_eq!(x, 1);
///
/// let mut x = Natural::ONE;
/// x >>= -1i8;
/// x >>= -2i16;
/// x >>= -3i32;
/// x >>= -4i64;
/// assert_eq!(x, 1024);
///
/// let mut x = Natural::from(1024u32);
/// x >>= 1i8;
/// x >>= 2i16;
/// x >>= 3i32;
/// x >>= 4i64;
/// assert_eq!(x, 1);
/// ```
pub mod shr;
/// Implementations of [`ShrRound`](malachite_base::num::arithmetic::traits::ShrRound) and
/// [`ShrRoundAssign`](malachite_base::num::arithmetic::traits::ShrRoundAssign), traits for
/// dividing a number by a power of 2 and rounding according to a specified
/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode).
///
/// # shr_round
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::basic::traits::Zero;
/// use malachite_base::rounding_modes::RoundingMode;
/// use malachite_base::num::arithmetic::traits::ShrRound;
/// use malachite_nz::natural::Natural;
///
/// assert_eq!(Natural::from(0x101u32).shr_round(8u8, RoundingMode::Down), 1);
/// assert_eq!(Natural::from(0x101u32).shr_round(8u16, RoundingMode::Up), 2);
/// assert_eq!(Natural::from(0x101u32).shr_round(9u32, RoundingMode::Down), 0);
/// assert_eq!(Natural::from(0x101u32).shr_round(9u64, RoundingMode::Up), 1);
/// assert_eq!(Natural::from(0x101u32).shr_round(9u8, RoundingMode::Nearest), 1);
/// assert_eq!(Natural::from(0xffu32).shr_round(9u16, RoundingMode::Nearest), 0);
/// assert_eq!(Natural::from(0x100u32).shr_round(9u32, RoundingMode::Nearest), 0);
/// assert_eq!(Natural::from(0x100u32).shr_round(8u64, RoundingMode::Exact), 1);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(8u8, RoundingMode::Down), 1);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(8u16, RoundingMode::Up), 2);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(9u32, RoundingMode::Down), 0);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(9u64, RoundingMode::Up), 1);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(9u8, RoundingMode::Nearest), 1);
/// assert_eq!((&Natural::from(0xffu32)).shr_round(9u16, RoundingMode::Nearest), 0);
/// assert_eq!((&Natural::from(0x100u32)).shr_round(9u32, RoundingMode::Nearest), 0);
/// assert_eq!((&Natural::from(0x100u32)).shr_round(8u64, RoundingMode::Exact), 1);
///
/// assert_eq!(Natural::from(0x101u32).shr_round(8i8, RoundingMode::Down), 1);
/// assert_eq!(Natural::from(0x101u32).shr_round(8i16, RoundingMode::Up), 2);
/// assert_eq!(Natural::from(0x101u32).shr_round(9i32, RoundingMode::Down), 0);
/// assert_eq!(Natural::from(0x101u32).shr_round(9i64, RoundingMode::Up), 1);
/// assert_eq!(Natural::from(0x101u32).shr_round(9i8, RoundingMode::Nearest), 1);
/// assert_eq!(Natural::from(0xffu32).shr_round(9i16, RoundingMode::Nearest), 0);
/// assert_eq!(Natural::from(0x100u32).shr_round(9i32, RoundingMode::Nearest), 0);
/// assert_eq!(Natural::from(0x100u32).shr_round(8i64, RoundingMode::Exact), 1);
/// assert_eq!(Natural::ZERO.shr_round(-10i8, RoundingMode::Exact), 0);
/// assert_eq!(Natural::from(123u32).shr_round(-2i16, RoundingMode::Exact), 492);
/// assert_eq!(
///     Natural::from(123u32).shr_round(-100i32, RoundingMode::Exact).to_string(),
///     "155921023828072216384094494261248"
/// );
/// assert_eq!((&Natural::from(0x101u32)).shr_round(8i8, RoundingMode::Down), 1);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(8i16, RoundingMode::Up), 2);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(9i32, RoundingMode::Down), 0);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(9i64, RoundingMode::Up), 1);
/// assert_eq!((&Natural::from(0x101u32)).shr_round(9i8, RoundingMode::Nearest), 1);
/// assert_eq!((&Natural::from(0xffu32)).shr_round(9i16, RoundingMode::Nearest), 0);
/// assert_eq!((&Natural::from(0x100u32)).shr_round(9i32, RoundingMode::Nearest), 0);
/// assert_eq!((&Natural::from(0x100u32)).shr_round(8i64, RoundingMode::Exact), 1);
/// assert_eq!((&Natural::ZERO).shr_round(-10i8, RoundingMode::Exact), 0);
/// assert_eq!((&Natural::from(123u32)).shr_round(-2i16, RoundingMode::Exact), 492);
/// assert_eq!(
///     (&Natural::from(123u32)).shr_round(-100i32, RoundingMode::Exact).to_string(),
///     "155921023828072216384094494261248"
/// );
/// ```
///
/// # shr_round_assign
/// ```
/// extern crate malachite_base;
///
/// use malachite_base::num::arithmetic::traits::ShrRoundAssign;
/// use malachite_base::num::basic::traits::One;
/// use malachite_base::rounding_modes::RoundingMode;
/// use malachite_nz::natural::Natural;
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(8u8, RoundingMode::Down);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(8u16, RoundingMode::Up);
/// assert_eq!(n, 2);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(9u32, RoundingMode::Down);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(9u64, RoundingMode::Up);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(9u8, RoundingMode::Nearest);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0xffu32);
/// n.shr_round_assign(9u16, RoundingMode::Nearest);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x100u32);
/// n.shr_round_assign(9u32, RoundingMode::Nearest);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x100u32);
/// n.shr_round_assign(8u64, RoundingMode::Exact);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(8i8, RoundingMode::Down);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(8i16, RoundingMode::Up);
/// assert_eq!(n, 2);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(9i32, RoundingMode::Down);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(9i64, RoundingMode::Up);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0x101u32);
/// n.shr_round_assign(9i8, RoundingMode::Nearest);
/// assert_eq!(n, 1);
///
/// let mut n = Natural::from(0xffu32);
/// n.shr_round_assign(9i16, RoundingMode::Nearest);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x100u32);
/// n.shr_round_assign(9i32, RoundingMode::Nearest);
/// assert_eq!(n, 0);
///
/// let mut n = Natural::from(0x100u32);
/// n.shr_round_assign(8i64, RoundingMode::Exact);
/// assert_eq!(n, 1);
///
/// let mut x = Natural::ONE;
/// x.shr_round_assign(-1i8, RoundingMode::Exact);
/// x.shr_round_assign(-2i16, RoundingMode::Exact);
/// x.shr_round_assign(-3i32, RoundingMode::Exact);
/// x.shr_round_assign(-4i64, RoundingMode::Exact);
/// assert_eq!(x, 1024);
/// ```
pub mod shr_round;
/// Implementations of [`Sign`](malachite_base::num::arithmetic::traits::Sign), a trait for
/// determining the sign of a number.
pub mod sign;
/// Implementations of traits for taking the square root of a number.
///
/// The traits are [`FloorSqrt`](malachite_base::num::arithmetic::traits::FloorSqrt),
/// [`FloorSqrtAssign`](malachite_base::num::arithmetic::traits::FloorSqrtAssign),
/// [`CeilingSqrt`](malachite_base::num::arithmetic::traits::CeilingSqrt),
/// [`CeilingSqrtAssign`](malachite_base::num::arithmetic::traits::CeilingSqrtAssign),
/// [`CheckedSqrt`](malachite_base::num::arithmetic::traits::CheckedSqrt),
/// [`SqrtRem`](malachite_base::num::arithmetic::traits::SqrtRem), and
/// [`SqrtAssignRem`](malachite_base::num::arithmetic::traits::SqrtAssignRem).
pub mod sqrt;
/// Implementations of [`Square`](malachite_base::num::arithmetic::traits::Square) and
/// [`SquareAssign`](malachite_base::num::arithmetic::traits::SquareAssign), traits for squaring a
/// number.
pub mod square;
/// Subtraction of [`Natural`](super::Natural)s.
pub mod sub;
/// Implementations of [`SubMul`](malachite_base::num::arithmetic::traits::SubMul) and
/// [`SubMulAssign`](malachite_base::num::arithmetic::traits::SubMulAssign), traits for subtracting
/// the product of two numbers from a number.
pub mod sub_mul;