malachite_float/arithmetic/
mod.rs

1// Copyright © 2025 Mikhail Hogrefe
2//
3// This file is part of Malachite.
4//
5// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
6// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
7// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
8
9/// Absolute value of [`Float`](super::Float)s.
10pub mod abs;
11/// Addition of [`Float`](super::Float)s, and of [`Float`](super::Float)s with
12/// [`Rational`](malachite_q::Rational)s.
13pub mod add;
14/// Division of [`Float`](super::Float)s, of [`Float`](super::Float)s by
15/// [`Rational`](malachite_q::Rational)s, and of [`Rational`](malachite_q::Rational)s by
16/// [`Float`](super::Float)s.
17pub mod div;
18/// An implementations of [`IsPowerOf2`](malachite_base::num::arithmetic::traits::IsPowerOf2), a
19/// trait for determining whether a number is an integer power of 2.
20pub mod is_power_of_2;
21/// Multiplication of [`Float`](super::Float)s, and of [`Float`](super::Float)s with
22/// [`Rational`](malachite_q::Rational)s.
23pub mod mul;
24/// Negation of [`Float`](super::Float)s.
25pub mod neg;
26/// Implementations of [`PowerOf2`](malachite_base::num::arithmetic::traits::PowerOf2), a trait for
27/// computing a power of 2.
28pub mod power_of_2;
29/// Implementations of [`Reciprocal`](malachite_base::num::arithmetic::traits::Reciprocal) and
30/// [`ReciprocalAssign`](malachite_base::num::arithmetic::traits::ReciprocalAssign), traits for
31/// computing the reciprocal of a number.
32pub mod reciprocal;
33/// [`ReciprocalSqrt`](malachite_base::num::arithmetic::traits::ReciprocalSqrt) and
34/// [`ReciprocalSqrtAssign`](malachite_base::num::arithmetic::traits::ReciprocalSqrtAssign), traits
35/// for computing the reciprocal of the square root of [`Float`](super::Float)s.
36pub mod reciprocal_sqrt;
37/// Left-shifting a [`Float`](super::Float) (multiplying it by a power of 2).
38///
39/// # shl
40/// ```
41/// use malachite_base::num::basic::traits::{Infinity, Zero};
42/// use malachite_float::Float;
43///
44/// assert_eq!(Float::ZERO << 10, 0);
45/// assert_eq!(Float::INFINITY << 10, Float::INFINITY);
46/// assert_eq!(
47///     (Float::from(std::f64::consts::PI) << 10u8).to_string(),
48///     "3216.990877275948"
49/// );
50/// assert_eq!(
51///     (Float::from(std::f64::consts::PI) << -10i8).to_string(),
52///     "0.003067961575771282"
53/// );
54///
55/// assert_eq!(&Float::ZERO << 10, 0);
56/// assert_eq!(&Float::INFINITY << 10, Float::INFINITY);
57/// assert_eq!(
58///     (&Float::from(std::f64::consts::PI) << 10u8).to_string(),
59///     "3216.990877275948"
60/// );
61/// assert_eq!(
62///     (&Float::from(std::f64::consts::PI) << -10i8).to_string(),
63///     "0.003067961575771282"
64/// );
65/// ```
66///
67/// # shl_assign
68/// ```
69/// use malachite_base::num::basic::traits::{Infinity, Zero};
70/// use malachite_float::Float;
71///
72/// let mut x = Float::ZERO;
73/// x <<= 10;
74/// assert_eq!(x, 0);
75///
76/// let mut x = Float::INFINITY;
77/// x <<= 10;
78/// assert_eq!(x, Float::INFINITY);
79///
80/// let mut x = Float::from(std::f64::consts::PI);
81/// x <<= 10;
82/// assert_eq!(x.to_string(), "3216.990877275948");
83///
84/// let mut x = Float::from(std::f64::consts::PI);
85/// x <<= -10;
86/// assert_eq!(x.to_string(), "0.003067961575771282");
87/// ```
88pub mod shl;
89/// Implementations of [`ShlRound`](malachite_base::num::arithmetic::traits::ShlRound) and
90/// [`ShlRoundAssign`](malachite_base::num::arithmetic::traits::ShlRoundAssign), traits for
91/// multiplying a number by a power of 2 and rounding according to a specified
92/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode). For [`Float`](super::Float)s,
93/// rounding is only necessary in the cases of overflow and underflow.
94///
95/// # shl_prec_round
96/// ```
97/// use malachite_base::rounding_modes::RoundingMode::*;
98/// use malachite_float::Float;
99/// use std::cmp::Ordering::*;
100///
101/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(10u8, 10, Nearest);
102/// assert_eq!(shifted.to_string(), "3216.0");
103/// assert_eq!(o, Less);
104///
105/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(-10i8, 10, Nearest);
106/// assert_eq!(shifted.to_string(), "0.003067");
107/// assert_eq!(o, Less);
108///
109/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(u32::MAX, 10, Floor);
110/// assert_eq!(shifted.to_string(), "too_big");
111/// assert_eq!(o, Less);
112///
113/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(u32::MAX, 10, Ceiling);
114/// assert_eq!(shifted.to_string(), "Infinity");
115/// assert_eq!(o, Greater);
116///
117/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(10u8, 10, Nearest);
118/// assert_eq!(shifted.to_string(), "3216.0");
119/// assert_eq!(o, Less);
120///
121/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(-10i8, 10, Nearest);
122/// assert_eq!(shifted.to_string(), "0.003067");
123/// assert_eq!(o, Less);
124///
125/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(u32::MAX, 10, Floor);
126/// assert_eq!(shifted.to_string(), "too_big");
127/// assert_eq!(o, Less);
128///
129/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(u32::MAX, 10, Ceiling);
130/// assert_eq!(shifted.to_string(), "Infinity");
131/// assert_eq!(o, Greater);
132/// ```
133///
134/// # shl_prec_round_assign
135/// ```
136/// use malachite_base::rounding_modes::RoundingMode::*;
137/// use malachite_float::Float;
138/// use std::cmp::Ordering::*;
139///
140/// let mut x = Float::from(std::f64::consts::PI);
141/// assert_eq!(x.shl_prec_round_assign(10u8, 10, Nearest), Less);
142/// assert_eq!(x.to_string(), "3216.0");
143///
144/// let mut x = Float::from(std::f64::consts::PI);
145/// assert_eq!(x.shl_prec_round_assign(-10i8, 10, Nearest), Less);
146/// assert_eq!(x.to_string(), "0.003067");
147///
148/// let mut x = Float::from(std::f64::consts::PI);
149/// assert_eq!(x.shl_prec_round_assign(u32::MAX, 10, Floor), Less);
150/// assert_eq!(x.to_string(), "too_big");
151///
152/// let mut x = Float::from(std::f64::consts::PI);
153/// assert_eq!(x.shl_prec_round_assign(u32::MAX, 10, Ceiling), Greater);
154/// assert_eq!(x.to_string(), "Infinity");
155/// ```
156///
157/// # shl_prec
158/// ```
159/// use malachite_float::Float;
160/// use std::cmp::Ordering::*;
161///
162/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec(10u8, 10);
163/// assert_eq!(shifted.to_string(), "3216.0");
164/// assert_eq!(o, Less);
165///
166/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec(-10i8, 10);
167/// assert_eq!(shifted.to_string(), "0.003067");
168/// assert_eq!(o, Less);
169///
170/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec(u32::MAX, 10);
171/// assert_eq!(shifted.to_string(), "Infinity");
172/// assert_eq!(o, Greater);
173///
174/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_ref(10u8, 10);
175/// assert_eq!(shifted.to_string(), "3216.0");
176/// assert_eq!(o, Less);
177///
178/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_ref(-10i8, 10);
179/// assert_eq!(shifted.to_string(), "0.003067");
180/// assert_eq!(o, Less);
181///
182/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_ref(u32::MAX, 10);
183/// assert_eq!(shifted.to_string(), "Infinity");
184/// assert_eq!(o, Greater);
185/// ```
186///
187/// # shl_prec_assign
188/// ```
189/// use malachite_float::Float;
190/// use std::cmp::Ordering::*;
191///
192/// let mut x = Float::from(std::f64::consts::PI);
193/// assert_eq!(x.shl_prec_assign(10u8, 10), Less);
194/// assert_eq!(x.to_string(), "3216.0");
195///
196/// let mut x = Float::from(std::f64::consts::PI);
197/// assert_eq!(x.shl_prec_assign(-10i8, 10), Less);
198/// assert_eq!(x.to_string(), "0.003067");
199///
200/// let mut x = Float::from(std::f64::consts::PI);
201/// assert_eq!(x.shl_prec_assign(u32::MAX, 10), Greater);
202/// assert_eq!(x.to_string(), "Infinity");
203/// ```
204///
205/// # shl_round
206/// ```
207/// use malachite_base::num::arithmetic::traits::ShlRound;
208/// use malachite_base::rounding_modes::RoundingMode::*;
209/// use malachite_float::Float;
210/// use std::cmp::Ordering::*;
211///
212/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(10u8, Nearest);
213/// assert_eq!(shifted.to_string(), "3216.990877275948");
214/// assert_eq!(o, Equal);
215///
216/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(-10i8, Nearest);
217/// assert_eq!(shifted.to_string(), "0.003067961575771282");
218/// assert_eq!(o, Equal);
219///
220/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(u32::MAX, Floor);
221/// assert_eq!(shifted.to_string(), "too_big");
222/// assert_eq!(o, Less);
223///
224/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(u32::MAX, Ceiling);
225/// assert_eq!(shifted.to_string(), "Infinity");
226/// assert_eq!(o, Greater);
227///
228/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(10u8, Nearest);
229/// assert_eq!(shifted.to_string(), "3216.990877275948");
230/// assert_eq!(o, Equal);
231///
232/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(-10i8, Nearest);
233/// assert_eq!(shifted.to_string(), "0.003067961575771282");
234/// assert_eq!(o, Equal);
235///
236/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(u32::MAX, Floor);
237/// assert_eq!(shifted.to_string(), "too_big");
238/// assert_eq!(o, Less);
239///
240/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(u32::MAX, Ceiling);
241/// assert_eq!(shifted.to_string(), "Infinity");
242/// assert_eq!(o, Greater);
243/// ```
244///
245/// # shl_round_assign
246/// ```
247/// use malachite_base::num::arithmetic::traits::ShlRoundAssign;
248/// use malachite_base::rounding_modes::RoundingMode::*;
249/// use malachite_float::Float;
250/// use std::cmp::Ordering::*;
251///
252/// let mut x = Float::from(std::f64::consts::PI);
253/// assert_eq!(x.shl_round_assign(10u8, Nearest), Equal);
254/// assert_eq!(x.to_string(), "3216.990877275948");
255///
256/// let mut x = Float::from(std::f64::consts::PI);
257/// assert_eq!(x.shl_round_assign(-10i8, Nearest), Equal);
258/// assert_eq!(x.to_string(), "0.003067961575771282");
259///
260/// let mut x = Float::from(std::f64::consts::PI);
261/// assert_eq!(x.shl_round_assign(u32::MAX, Floor), Less);
262/// assert_eq!(x.to_string(), "too_big");
263///
264/// let mut x = Float::from(std::f64::consts::PI);
265/// assert_eq!(x.shl_round_assign(u32::MAX, Ceiling), Greater);
266/// assert_eq!(x.to_string(), "Infinity");
267/// ```
268pub mod shl_round;
269/// Right-shifting a [`Float`](super::Float) (dividing it by a power of 2).
270///
271/// # shr
272/// ```
273/// use malachite_base::num::basic::traits::{Infinity, Zero};
274/// use malachite_float::Float;
275///
276/// assert_eq!(Float::ZERO >> 10, 0);
277/// assert_eq!(Float::INFINITY >> 10, Float::INFINITY);
278/// assert_eq!(
279///     (Float::from(std::f64::consts::PI) >> 10u8).to_string(),
280///     "0.003067961575771282"
281/// );
282/// assert_eq!(
283///     (Float::from(std::f64::consts::PI) >> -10i8).to_string(),
284///     "3216.990877275948"
285/// );
286///
287/// assert_eq!(&Float::ZERO >> 10, 0);
288/// assert_eq!(&Float::INFINITY >> 10, Float::INFINITY);
289/// assert_eq!(
290///     (&Float::from(std::f64::consts::PI) >> 10u8).to_string(),
291///     "0.003067961575771282"
292/// );
293/// assert_eq!(
294///     (&Float::from(std::f64::consts::PI) >> -10i8).to_string(),
295///     "3216.990877275948"
296/// );
297/// ```
298///
299/// # shr_assign
300/// ```
301/// use malachite_base::num::basic::traits::{Infinity, Zero};
302/// use malachite_float::Float;
303///
304/// let mut x = Float::ZERO;
305/// x >>= 10;
306/// assert_eq!(x, 0);
307///
308/// let mut x = Float::INFINITY;
309/// x >>= 10;
310/// assert_eq!(x, Float::INFINITY);
311///
312/// let mut x = Float::from(std::f64::consts::PI);
313/// x >>= 10;
314/// assert_eq!(x.to_string(), "0.003067961575771282");
315///
316/// let mut x = Float::from(std::f64::consts::PI);
317/// x >>= -10;
318/// assert_eq!(x.to_string(), "3216.990877275948");
319/// ```
320pub mod shr;
321/// Implementations of [`ShlRound`](malachite_base::num::arithmetic::traits::ShrRound) and
322/// [`ShrRoundAssign`](malachite_base::num::arithmetic::traits::ShrRoundAssign), traits for dividing
323/// a number by a power of 2 and rounding according to a specified
324/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode). For [`Float`](super::Float)s,
325/// rounding is only necessary in the cases of overflow and underflow.
326///
327/// # shr_prec_round
328/// ```
329/// use malachite_base::rounding_modes::RoundingMode::*;
330/// use malachite_float::Float;
331/// use std::cmp::Ordering::*;
332///
333/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(10u8, 10, Nearest);
334/// assert_eq!(shifted.to_string(), "0.003067");
335/// assert_eq!(o, Less);
336///
337/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(-10i8, 10, Nearest);
338/// assert_eq!(shifted.to_string(), "3216.0");
339/// assert_eq!(o, Less);
340///
341/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(u32::MAX, 10, Floor);
342/// assert_eq!(shifted.to_string(), "0.0");
343/// assert_eq!(o, Less);
344///
345/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(u32::MAX, 10, Ceiling);
346/// assert_eq!(shifted.to_string(), "too_small");
347/// assert_eq!(o, Greater);
348///
349/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(10u8, 10, Nearest);
350/// assert_eq!(shifted.to_string(), "0.003067");
351/// assert_eq!(o, Less);
352///
353/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(-10i8, 10, Nearest);
354/// assert_eq!(shifted.to_string(), "3216.0");
355/// assert_eq!(o, Less);
356///
357/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(u32::MAX, 10, Floor);
358/// assert_eq!(shifted.to_string(), "0.0");
359/// assert_eq!(o, Less);
360///
361/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(u32::MAX, 10, Ceiling);
362/// assert_eq!(shifted.to_string(), "too_small");
363/// assert_eq!(o, Greater);
364/// ```
365///
366/// # shr_prec_round_assign
367/// ```
368/// use malachite_base::rounding_modes::RoundingMode::*;
369/// use malachite_float::Float;
370/// use std::cmp::Ordering::*;
371///
372/// let mut x = Float::from(std::f64::consts::PI);
373/// assert_eq!(x.shr_prec_round_assign(10u8, 10, Nearest), Less);
374/// assert_eq!(x.to_string(), "0.003067");
375///
376/// let mut x = Float::from(std::f64::consts::PI);
377/// assert_eq!(x.shr_prec_round_assign(-10i8, 10, Nearest), Less);
378/// assert_eq!(x.to_string(), "3216.0");
379///
380/// let mut x = Float::from(std::f64::consts::PI);
381/// assert_eq!(x.shr_prec_round_assign(u32::MAX, 10, Floor), Less);
382/// assert_eq!(x.to_string(), "0.0");
383///
384/// let mut x = Float::from(std::f64::consts::PI);
385/// assert_eq!(x.shr_prec_round_assign(u32::MAX, 10, Ceiling), Greater);
386/// assert_eq!(x.to_string(), "too_small");
387/// ```
388///
389/// # shr_prec
390/// ```
391/// use malachite_float::Float;
392/// use std::cmp::Ordering::*;
393///
394/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec(10u8, 10);
395/// assert_eq!(shifted.to_string(), "0.003067");
396/// assert_eq!(o, Less);
397///
398/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec(-10i8, 10);
399/// assert_eq!(shifted.to_string(), "3216.0");
400/// assert_eq!(o, Less);
401///
402/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec(u32::MAX, 10);
403/// assert_eq!(shifted.to_string(), "0.0");
404/// assert_eq!(o, Less);
405///
406/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_ref(10u8, 10);
407/// assert_eq!(shifted.to_string(), "0.003067");
408/// assert_eq!(o, Less);
409///
410/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_ref(-10i8, 10);
411/// assert_eq!(shifted.to_string(), "3216.0");
412/// assert_eq!(o, Less);
413///
414/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_ref(u32::MAX, 10);
415/// assert_eq!(shifted.to_string(), "0.0");
416/// assert_eq!(o, Less);
417/// ```
418///
419/// # shr_prec_assign
420/// ```
421/// use malachite_float::Float;
422/// use std::cmp::Ordering::*;
423///
424/// let mut x = Float::from(std::f64::consts::PI);
425/// assert_eq!(x.shr_prec_assign(10u8, 10), Less);
426/// assert_eq!(x.to_string(), "0.003067");
427///
428/// let mut x = Float::from(std::f64::consts::PI);
429/// assert_eq!(x.shr_prec_assign(-10i8, 10), Less);
430/// assert_eq!(x.to_string(), "3216.0");
431///
432/// let mut x = Float::from(std::f64::consts::PI);
433/// assert_eq!(x.shr_prec_assign(u32::MAX, 10), Less);
434/// assert_eq!(x.to_string(), "0.0");
435/// ```
436///
437/// # shr_round
438/// ```
439/// use malachite_base::num::arithmetic::traits::ShrRound;
440/// use malachite_base::rounding_modes::RoundingMode::*;
441/// use malachite_float::Float;
442/// use std::cmp::Ordering::*;
443///
444/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(10u8, Nearest);
445/// assert_eq!(shifted.to_string(), "0.003067961575771282");
446/// assert_eq!(o, Equal);
447///
448/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(-10i8, Nearest);
449/// assert_eq!(shifted.to_string(), "3216.990877275948");
450/// assert_eq!(o, Equal);
451///
452/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(u32::MAX, Floor);
453/// assert_eq!(shifted.to_string(), "0.0");
454/// assert_eq!(o, Less);
455///
456/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(u32::MAX, Ceiling);
457/// assert_eq!(shifted.to_string(), "too_small");
458/// assert_eq!(o, Greater);
459///
460/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(10u8, Nearest);
461/// assert_eq!(shifted.to_string(), "0.003067961575771282");
462/// assert_eq!(o, Equal);
463///
464/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(-10i8, Nearest);
465/// assert_eq!(shifted.to_string(), "3216.990877275948");
466/// assert_eq!(o, Equal);
467///
468/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(u32::MAX, Floor);
469/// assert_eq!(shifted.to_string(), "0.0");
470/// assert_eq!(o, Less);
471///
472/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(u32::MAX, Ceiling);
473/// assert_eq!(shifted.to_string(), "too_small");
474/// assert_eq!(o, Greater);
475/// ```
476///
477/// # shr_round_assign
478/// ```
479/// use malachite_base::num::arithmetic::traits::ShrRoundAssign;
480/// use malachite_base::rounding_modes::RoundingMode::*;
481/// use malachite_float::Float;
482/// use std::cmp::Ordering::*;
483///
484/// let mut x = Float::from(std::f64::consts::PI);
485/// assert_eq!(x.shr_round_assign(10u8, Nearest), Equal);
486/// assert_eq!(x.to_string(), "0.003067961575771282");
487///
488/// let mut x = Float::from(std::f64::consts::PI);
489/// assert_eq!(x.shr_round_assign(-10i8, Nearest), Equal);
490/// assert_eq!(x.to_string(), "3216.990877275948");
491///
492/// let mut x = Float::from(std::f64::consts::PI);
493/// assert_eq!(x.shr_round_assign(u32::MAX, Floor), Less);
494/// assert_eq!(x.to_string(), "0.0");
495///
496/// let mut x = Float::from(std::f64::consts::PI);
497/// assert_eq!(x.shr_round_assign(u32::MAX, Ceiling), Greater);
498/// assert_eq!(x.to_string(), "too_small");
499/// ```
500pub mod shr_round;
501/// An implementation of [`Sign`](malachite_base::num::arithmetic::traits::Sign), a trait for
502/// determining the sign of a number.
503pub mod sign;
504/// [`Sqrt`](malachite_base::num::arithmetic::traits::Sqrt) and
505/// [`SqrtAssign`](malachite_base::num::arithmetic::traits::SqrtAssign), traits for computing the
506/// square root of [`Float`](super::Float)s.
507pub mod sqrt;
508/// Squaring of [`Float`](super::Float)s.
509pub mod square;
510/// Subtraction of [`Float`](super::Float)s, of [`Float`](super::Float)s by
511/// [`Rational`](malachite_q::Rational)s, and of [`Rational`](malachite_q::Rational)s by
512/// [`Float`](super::Float)s.
513pub mod sub;