malachite_float/float/arithmetic/mod.rs
1// Copyright © 2026 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/// Taking the AGM (arithmetic-geometric mean) of two [`Float`](super::Float)s, and of
15/// [`Float`](super::Float)s with [`Rational`](malachite_q::Rational)s.
16pub mod agm;
17/// Cube root of [`Float`](super::Float)s and of [`Rational`](malachite_q::Rational)s.
18pub mod cbrt;
19/// Division of [`Float`](super::Float)s, of [`Float`](super::Float)s by
20/// [`Rational`](malachite_q::Rational)s, and of [`Rational`](malachite_q::Rational)s by
21/// [`Float`](super::Float)s.
22pub mod div;
23/// [`Exp`](malachite_base::num::arithmetic::traits::Exp) and
24/// [`ExpAssign`](malachite_base::num::arithmetic::traits::ExpAssign), traits for computing $e^x$
25/// for [`Float`](super::Float)s.
26pub mod exp;
27/// [`ExpXMinus1`](malachite_base::num::arithmetic::traits::ExpXMinus1) and
28/// [`ExpXMinus1Assign`](malachite_base::num::arithmetic::traits::ExpXMinus1Assign), traits for
29/// computing $e^x-1$ for [`Float`](super::Float)s.
30pub mod exp_x_minus_1;
31/// An implementation of [`IsPowerOf2`](malachite_base::num::arithmetic::traits::IsPowerOf2), a
32/// trait for determining whether a number is an integer power of 2.
33pub mod is_power_of_2;
34/// [`Ln`](malachite_base::num::arithmetic::traits::Ln) and
35/// [`LnAssign`](malachite_base::num::arithmetic::traits::LnAssign), traits for computing the
36/// natural logarithm of [`Float`](super::Float)s.
37pub mod ln;
38/// [`Ln1PlusX`](malachite_base::num::arithmetic::traits::Ln1PlusX) and
39/// [`Ln1PlusXAssign`](malachite_base::num::arithmetic::traits::Ln1PlusXAssign), traits for
40/// computing $\ln(1+x)$ for [`Float`](super::Float)s.
41pub mod ln_1_plus_x;
42/// [`LogBase`](malachite_base::num::arithmetic::traits::LogBase) and
43/// [`LogBaseAssign`](malachite_base::num::arithmetic::traits::LogBaseAssign), traits for computing
44/// the base-$b$ logarithm of [`Float`](super::Float)s for an arbitrary integer base $b>1$.
45pub mod log_base;
46/// [`LogBase10`](malachite_base::num::arithmetic::traits::LogBase10) and
47/// [`LogBase10Assign`](malachite_base::num::arithmetic::traits::LogBase10Assign), traits for
48/// computing the base-10 logarithm of [`Float`](super::Float)s.
49pub mod log_base_10;
50/// [`LogBase10Of1PlusX`](malachite_base::num::arithmetic::traits::LogBase10Of1PlusX) and
51/// [`LogBase10Of1PlusXAssign`](malachite_base::num::arithmetic::traits::LogBase10Of1PlusXAssign),
52/// traits for computing $\log_{10}(1+x)$ of [`Float`](super::Float)s.
53pub mod log_base_10_1_plus_x;
54/// [`LogBaseOf1PlusX`](malachite_base::num::arithmetic::traits::LogBaseOf1PlusX) and
55/// [`LogBaseOf1PlusXAssign`](malachite_base::num::arithmetic::traits::LogBaseOf1PlusXAssign),
56/// traits for computing $\log_b(1+x)$ of [`Float`](super::Float)s for an arbitrary integer base
57/// $b>1$.
58pub mod log_base_1_plus_x;
59/// [`LogBase2`](malachite_base::num::arithmetic::traits::LogBase2) and
60/// [`LogBase2Assign`](malachite_base::num::arithmetic::traits::LogBase2Assign), traits for
61/// computing the base-2 logarithm of [`Float`](super::Float)s.
62pub mod log_base_2;
63/// [`LogBase2Of1PlusX`](malachite_base::num::arithmetic::traits::LogBase2Of1PlusX) and
64/// [`LogBase2Of1PlusXAssign`](malachite_base::num::arithmetic::traits::LogBase2Of1PlusXAssign),
65/// traits for computing $\log_2(1+x)$ for [`Float`](super::Float)s.
66pub mod log_base_2_1_plus_x;
67/// [`LogBase`](malachite_base::num::arithmetic::traits::LogBase) and
68/// [`LogBaseAssign`](malachite_base::num::arithmetic::traits::LogBaseAssign), implemented for a
69/// [`Float`](super::Float) base, for computing $\log_b x$ of a [`Float`](super::Float) with an
70/// arbitrary [`Float`](super::Float) base.
71pub mod log_base_float_base;
72/// [`LogBaseOf1PlusX`](malachite_base::num::arithmetic::traits::LogBaseOf1PlusX) and
73/// [`LogBaseOf1PlusXAssign`](malachite_base::num::arithmetic::traits::LogBaseOf1PlusXAssign),
74/// implemented for a [`Float`](super::Float) base, for computing $\log_b(1+x)$ of a
75/// [`Float`](super::Float) with an arbitrary [`Float`](super::Float) base.
76pub mod log_base_float_base_1_plus_x;
77/// [`LogBasePowerOf2`](malachite_base::num::arithmetic::traits::LogBasePowerOf2) and
78/// [`LogBasePowerOf2Assign`](malachite_base::num::arithmetic::traits::LogBasePowerOf2Assign),
79/// traits for computing $\log_{2^k} x$ for [`Float`](super::Float)s.
80pub mod log_base_power_of_2;
81/// [`LogBasePowerOf2Of1PlusX`](malachite_base::num::arithmetic::traits::LogBasePowerOf2Of1PlusX)
82/// and
83/// [`LogBasePowerOf2Of1PlusXAssign`](malachite_base::num::arithmetic::traits::LogBasePowerOf2Of1PlusXAssign),
84/// traits for computing $\log_{2^k}(1+x)$ for [`Float`](super::Float)s.
85#[cfg_attr(dylint_lib = "malachite_lints", expect(long_lines))]
86pub mod log_base_power_of_2_1_plus_x;
87/// [`LogBase`](malachite_base::num::arithmetic::traits::LogBase) and
88/// [`LogBaseAssign`](malachite_base::num::arithmetic::traits::LogBaseAssign), implemented for a
89/// [`Rational`](malachite_q::Rational) base, for computing $\log_b x$ of a [`Float`](super::Float)
90/// with an arbitrary rational base $b>1$.
91pub mod log_base_rational_base;
92/// [`LogBaseOf1PlusX`](malachite_base::num::arithmetic::traits::LogBaseOf1PlusX) and
93/// [`LogBaseOf1PlusXAssign`](malachite_base::num::arithmetic::traits::LogBaseOf1PlusXAssign),
94/// implemented for a [`Rational`](malachite_q::Rational) base, for computing $\log_b(1+x)$ of a
95/// [`Float`](super::Float) with an arbitrary rational base $b>1$.
96pub mod log_base_rational_base_1_plus_x;
97/// Functions for computing $\log_b x$ of a [`Rational`](malachite_q::Rational) $x$ with an
98/// arbitrary [`Float`](super::Float) base, returning a [`Float`](super::Float).
99pub mod log_base_rational_float_base;
100/// Functions for computing $\log_b x$ of a [`Rational`](malachite_q::Rational) $x$ with an
101/// arbitrary [`Rational`](malachite_q::Rational) base $b>1$, returning a [`Float`](super::Float).
102pub mod log_base_rational_rational_base;
103/// Multiplication of [`Float`](super::Float)s, and of [`Float`](super::Float)s with
104/// [`Rational`](malachite_q::Rational)s.
105pub mod mul;
106/// Negation of [`Float`](super::Float)s.
107pub mod neg;
108/// Implementations of [`PowerOf2`](malachite_base::num::arithmetic::traits::PowerOf2), a trait for
109/// computing a power of 2.
110pub mod pow;
111/// An implementation of [`PowerOf2`](malachite_base::num::arithmetic::traits::PowerOf2) with a
112/// [`Float`](super::Float) exponent, computing $2^x$ for [`Float`](super::Float)s.
113pub mod power_of_10;
114pub mod power_of_10_x_minus_1;
115pub mod power_of_2;
116pub mod power_of_2_of_float;
117/// Implementations of [`PowerOf2XMinus1`](malachite_base::num::arithmetic::traits::PowerOf2XMinus1)
118/// and [`PowerOf2XMinus1Assign`](malachite_base::num::arithmetic::traits::PowerOf2XMinus1Assign),
119/// traits for computing $2^x-1$.
120pub mod power_of_2_x_minus_1;
121/// Implementations of [`Reciprocal`](malachite_base::num::arithmetic::traits::Reciprocal) and
122/// [`ReciprocalAssign`](malachite_base::num::arithmetic::traits::ReciprocalAssign), traits for
123/// computing the reciprocal of a number.
124pub mod reciprocal;
125/// [`ReciprocalSqrt`](malachite_base::num::arithmetic::traits::ReciprocalSqrt) and
126/// [`ReciprocalSqrtAssign`](malachite_base::num::arithmetic::traits::ReciprocalSqrtAssign), traits
127/// for computing the reciprocal of the square root of [`Float`](super::Float)s.
128pub mod reciprocal_sqrt;
129/// [`root_u_prec_round`](super::Float::root_u_prec_round) and related functions, for computing
130/// roots of [`Float`](super::Float)s.
131pub mod root;
132pub(crate) mod round_near_x;
133/// Left-shifting a [`Float`](super::Float) (multiplying it by a power of 2).
134///
135/// # shl
136/// ```
137/// use malachite_base::num::basic::traits::{Infinity, Zero};
138/// use malachite_float::Float;
139///
140/// assert_eq!(Float::ZERO << 10, 0);
141/// assert_eq!(Float::INFINITY << 10, Float::INFINITY);
142/// assert_eq!(
143/// (Float::from(std::f64::consts::PI) << 10u8).to_string(),
144/// "3216.9908772759482"
145/// );
146/// assert_eq!(
147/// (Float::from(std::f64::consts::PI) << -10i8).to_string(),
148/// "0.0030679615757712823"
149/// );
150///
151/// assert_eq!(&Float::ZERO << 10, 0);
152/// assert_eq!(&Float::INFINITY << 10, Float::INFINITY);
153/// assert_eq!(
154/// (&Float::from(std::f64::consts::PI) << 10u8).to_string(),
155/// "3216.9908772759482"
156/// );
157/// assert_eq!(
158/// (&Float::from(std::f64::consts::PI) << -10i8).to_string(),
159/// "0.0030679615757712823"
160/// );
161/// ```
162///
163/// # shl_assign
164/// ```
165/// use malachite_base::num::basic::traits::{Infinity, Zero};
166/// use malachite_float::Float;
167///
168/// let mut x = Float::ZERO;
169/// x <<= 10;
170/// assert_eq!(x, 0);
171///
172/// let mut x = Float::INFINITY;
173/// x <<= 10;
174/// assert_eq!(x, Float::INFINITY);
175///
176/// let mut x = Float::from(std::f64::consts::PI);
177/// x <<= 10;
178/// assert_eq!(x.to_string(), "3216.9908772759482");
179///
180/// let mut x = Float::from(std::f64::consts::PI);
181/// x <<= -10;
182/// assert_eq!(x.to_string(), "0.0030679615757712823");
183/// ```
184pub mod shl;
185/// Implementations of [`ShlRound`](malachite_base::num::arithmetic::traits::ShlRound) and
186/// [`ShlRoundAssign`](malachite_base::num::arithmetic::traits::ShlRoundAssign), traits for
187/// multiplying a number by a power of 2 and rounding according to a specified
188/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode). For [`Float`](super::Float)s,
189/// rounding is only necessary in the cases of overflow and underflow.
190///
191/// # shl_prec_round
192/// ```
193/// use malachite_base::rounding_modes::RoundingMode::*;
194/// use malachite_float::Float;
195/// use std::cmp::Ordering::*;
196///
197/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(10u8, 10, Nearest);
198/// assert_eq!(shifted.to_string(), "3216.0");
199/// assert_eq!(o, Less);
200///
201/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(-10i8, 10, Nearest);
202/// assert_eq!(shifted.to_string(), "0.0030670");
203/// assert_eq!(o, Less);
204///
205/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(u32::MAX, 10, Floor);
206/// assert_eq!(shifted.to_string(), "2.0965e323228496");
207/// assert_eq!(o, Less);
208///
209/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round(u32::MAX, 10, Ceiling);
210/// assert_eq!(shifted.to_string(), "Infinity");
211/// assert_eq!(o, Greater);
212///
213/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(10u8, 10, Nearest);
214/// assert_eq!(shifted.to_string(), "3216.0");
215/// assert_eq!(o, Less);
216///
217/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(-10i8, 10, Nearest);
218/// assert_eq!(shifted.to_string(), "0.0030670");
219/// assert_eq!(o, Less);
220///
221/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(u32::MAX, 10, Floor);
222/// assert_eq!(shifted.to_string(), "2.0965e323228496");
223/// assert_eq!(o, Less);
224///
225/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_round_ref(u32::MAX, 10, Ceiling);
226/// assert_eq!(shifted.to_string(), "Infinity");
227/// assert_eq!(o, Greater);
228/// ```
229///
230/// # shl_prec_round_assign
231/// ```
232/// use malachite_base::rounding_modes::RoundingMode::*;
233/// use malachite_float::Float;
234/// use std::cmp::Ordering::*;
235///
236/// let mut x = Float::from(std::f64::consts::PI);
237/// assert_eq!(x.shl_prec_round_assign(10u8, 10, Nearest), Less);
238/// assert_eq!(x.to_string(), "3216.0");
239///
240/// let mut x = Float::from(std::f64::consts::PI);
241/// assert_eq!(x.shl_prec_round_assign(-10i8, 10, Nearest), Less);
242/// assert_eq!(x.to_string(), "0.0030670");
243///
244/// let mut x = Float::from(std::f64::consts::PI);
245/// assert_eq!(x.shl_prec_round_assign(u32::MAX, 10, Floor), Less);
246/// assert_eq!(x.to_string(), "2.0965e323228496");
247///
248/// let mut x = Float::from(std::f64::consts::PI);
249/// assert_eq!(x.shl_prec_round_assign(u32::MAX, 10, Ceiling), Greater);
250/// assert_eq!(x.to_string(), "Infinity");
251/// ```
252///
253/// # shl_prec
254/// ```
255/// use malachite_float::Float;
256/// use std::cmp::Ordering::*;
257///
258/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec(10u8, 10);
259/// assert_eq!(shifted.to_string(), "3216.0");
260/// assert_eq!(o, Less);
261///
262/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec(-10i8, 10);
263/// assert_eq!(shifted.to_string(), "0.0030670");
264/// assert_eq!(o, Less);
265///
266/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec(u32::MAX, 10);
267/// assert_eq!(shifted.to_string(), "Infinity");
268/// assert_eq!(o, Greater);
269///
270/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_ref(10u8, 10);
271/// assert_eq!(shifted.to_string(), "3216.0");
272/// assert_eq!(o, Less);
273///
274/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_ref(-10i8, 10);
275/// assert_eq!(shifted.to_string(), "0.0030670");
276/// assert_eq!(o, Less);
277///
278/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_prec_ref(u32::MAX, 10);
279/// assert_eq!(shifted.to_string(), "Infinity");
280/// assert_eq!(o, Greater);
281/// ```
282///
283/// # shl_prec_assign
284/// ```
285/// use malachite_float::Float;
286/// use std::cmp::Ordering::*;
287///
288/// let mut x = Float::from(std::f64::consts::PI);
289/// assert_eq!(x.shl_prec_assign(10u8, 10), Less);
290/// assert_eq!(x.to_string(), "3216.0");
291///
292/// let mut x = Float::from(std::f64::consts::PI);
293/// assert_eq!(x.shl_prec_assign(-10i8, 10), Less);
294/// assert_eq!(x.to_string(), "0.0030670");
295///
296/// let mut x = Float::from(std::f64::consts::PI);
297/// assert_eq!(x.shl_prec_assign(u32::MAX, 10), Greater);
298/// assert_eq!(x.to_string(), "Infinity");
299/// ```
300///
301/// # shl_round
302/// ```
303/// use malachite_base::num::arithmetic::traits::ShlRound;
304/// use malachite_base::rounding_modes::RoundingMode::*;
305/// use malachite_float::Float;
306/// use std::cmp::Ordering::*;
307///
308/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(10u8, Nearest);
309/// assert_eq!(shifted.to_string(), "3216.9908772759482");
310/// assert_eq!(o, Equal);
311///
312/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(-10i8, Nearest);
313/// assert_eq!(shifted.to_string(), "0.0030679615757712823");
314/// assert_eq!(o, Equal);
315///
316/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(u32::MAX, Floor);
317/// assert_eq!(shifted.to_string(), "2.0985787164673858e323228496");
318/// assert_eq!(o, Less);
319///
320/// let (shifted, o) = Float::from(std::f64::consts::PI).shl_round(u32::MAX, Ceiling);
321/// assert_eq!(shifted.to_string(), "Infinity");
322/// assert_eq!(o, Greater);
323///
324/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(10u8, Nearest);
325/// assert_eq!(shifted.to_string(), "3216.9908772759482");
326/// assert_eq!(o, Equal);
327///
328/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(-10i8, Nearest);
329/// assert_eq!(shifted.to_string(), "0.0030679615757712823");
330/// assert_eq!(o, Equal);
331///
332/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(u32::MAX, Floor);
333/// assert_eq!(shifted.to_string(), "2.0985787164673858e323228496");
334/// assert_eq!(o, Less);
335///
336/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shl_round(u32::MAX, Ceiling);
337/// assert_eq!(shifted.to_string(), "Infinity");
338/// assert_eq!(o, Greater);
339/// ```
340///
341/// # shl_round_assign
342/// ```
343/// use malachite_base::num::arithmetic::traits::ShlRoundAssign;
344/// use malachite_base::rounding_modes::RoundingMode::*;
345/// use malachite_float::Float;
346/// use std::cmp::Ordering::*;
347///
348/// let mut x = Float::from(std::f64::consts::PI);
349/// assert_eq!(x.shl_round_assign(10u8, Nearest), Equal);
350/// assert_eq!(x.to_string(), "3216.9908772759482");
351///
352/// let mut x = Float::from(std::f64::consts::PI);
353/// assert_eq!(x.shl_round_assign(-10i8, Nearest), Equal);
354/// assert_eq!(x.to_string(), "0.0030679615757712823");
355///
356/// let mut x = Float::from(std::f64::consts::PI);
357/// assert_eq!(x.shl_round_assign(u32::MAX, Floor), Less);
358/// assert_eq!(x.to_string(), "2.0985787164673858e323228496");
359///
360/// let mut x = Float::from(std::f64::consts::PI);
361/// assert_eq!(x.shl_round_assign(u32::MAX, Ceiling), Greater);
362/// assert_eq!(x.to_string(), "Infinity");
363/// ```
364pub mod shl_round;
365/// Right-shifting a [`Float`](super::Float) (dividing it by a power of 2).
366///
367/// # shr
368/// ```
369/// use malachite_base::num::basic::traits::{Infinity, Zero};
370/// use malachite_float::Float;
371///
372/// assert_eq!(Float::ZERO >> 10, 0);
373/// assert_eq!(Float::INFINITY >> 10, Float::INFINITY);
374/// assert_eq!(
375/// (Float::from(std::f64::consts::PI) >> 10u8).to_string(),
376/// "0.0030679615757712823"
377/// );
378/// assert_eq!(
379/// (Float::from(std::f64::consts::PI) >> -10i8).to_string(),
380/// "3216.9908772759482"
381/// );
382///
383/// assert_eq!(&Float::ZERO >> 10, 0);
384/// assert_eq!(&Float::INFINITY >> 10, Float::INFINITY);
385/// assert_eq!(
386/// (&Float::from(std::f64::consts::PI) >> 10u8).to_string(),
387/// "0.0030679615757712823"
388/// );
389/// assert_eq!(
390/// (&Float::from(std::f64::consts::PI) >> -10i8).to_string(),
391/// "3216.9908772759482"
392/// );
393/// ```
394///
395/// # shr_assign
396/// ```
397/// use malachite_base::num::basic::traits::{Infinity, Zero};
398/// use malachite_float::Float;
399///
400/// let mut x = Float::ZERO;
401/// x >>= 10;
402/// assert_eq!(x, 0);
403///
404/// let mut x = Float::INFINITY;
405/// x >>= 10;
406/// assert_eq!(x, Float::INFINITY);
407///
408/// let mut x = Float::from(std::f64::consts::PI);
409/// x >>= 10;
410/// assert_eq!(x.to_string(), "0.0030679615757712823");
411///
412/// let mut x = Float::from(std::f64::consts::PI);
413/// x >>= -10;
414/// assert_eq!(x.to_string(), "3216.9908772759482");
415/// ```
416pub mod shr;
417/// Implementations of [`ShlRound`](malachite_base::num::arithmetic::traits::ShrRound) and
418/// [`ShrRoundAssign`](malachite_base::num::arithmetic::traits::ShrRoundAssign), traits for dividing
419/// a number by a power of 2 and rounding according to a specified
420/// [`RoundingMode`](malachite_base::rounding_modes::RoundingMode). For [`Float`](super::Float)s,
421/// rounding is only necessary in the cases of overflow and underflow.
422///
423/// # shr_prec_round
424/// ```
425/// use malachite_base::rounding_modes::RoundingMode::*;
426/// use malachite_float::Float;
427/// use std::cmp::Ordering::*;
428///
429/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(10u8, 10, Nearest);
430/// assert_eq!(shifted.to_string(), "0.0030670");
431/// assert_eq!(o, Less);
432///
433/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(-10i8, 10, Nearest);
434/// assert_eq!(shifted.to_string(), "3216.0");
435/// assert_eq!(o, Less);
436///
437/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(u32::MAX, 10, Floor);
438/// assert_eq!(shifted.to_string(), "0.0");
439/// assert_eq!(o, Less);
440///
441/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round(u32::MAX, 10, Ceiling);
442/// assert_eq!(shifted.to_string(), "2.3826e-323228497");
443/// assert_eq!(o, Greater);
444///
445/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(10u8, 10, Nearest);
446/// assert_eq!(shifted.to_string(), "0.0030670");
447/// assert_eq!(o, Less);
448///
449/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(-10i8, 10, Nearest);
450/// assert_eq!(shifted.to_string(), "3216.0");
451/// assert_eq!(o, Less);
452///
453/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(u32::MAX, 10, Floor);
454/// assert_eq!(shifted.to_string(), "0.0");
455/// assert_eq!(o, Less);
456///
457/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_round_ref(u32::MAX, 10, Ceiling);
458/// assert_eq!(shifted.to_string(), "2.3826e-323228497");
459/// assert_eq!(o, Greater);
460/// ```
461///
462/// # shr_prec_round_assign
463/// ```
464/// use malachite_base::rounding_modes::RoundingMode::*;
465/// use malachite_float::Float;
466/// use std::cmp::Ordering::*;
467///
468/// let mut x = Float::from(std::f64::consts::PI);
469/// assert_eq!(x.shr_prec_round_assign(10u8, 10, Nearest), Less);
470/// assert_eq!(x.to_string(), "0.0030670");
471///
472/// let mut x = Float::from(std::f64::consts::PI);
473/// assert_eq!(x.shr_prec_round_assign(-10i8, 10, Nearest), Less);
474/// assert_eq!(x.to_string(), "3216.0");
475///
476/// let mut x = Float::from(std::f64::consts::PI);
477/// assert_eq!(x.shr_prec_round_assign(u32::MAX, 10, Floor), Less);
478/// assert_eq!(x.to_string(), "0.0");
479///
480/// let mut x = Float::from(std::f64::consts::PI);
481/// assert_eq!(x.shr_prec_round_assign(u32::MAX, 10, Ceiling), Greater);
482/// assert_eq!(x.to_string(), "2.3826e-323228497");
483/// ```
484///
485/// # shr_prec
486/// ```
487/// use malachite_float::Float;
488/// use std::cmp::Ordering::*;
489///
490/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec(10u8, 10);
491/// assert_eq!(shifted.to_string(), "0.0030670");
492/// assert_eq!(o, Less);
493///
494/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec(-10i8, 10);
495/// assert_eq!(shifted.to_string(), "3216.0");
496/// assert_eq!(o, Less);
497///
498/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec(u32::MAX, 10);
499/// assert_eq!(shifted.to_string(), "0.0");
500/// assert_eq!(o, Less);
501///
502/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_ref(10u8, 10);
503/// assert_eq!(shifted.to_string(), "0.0030670");
504/// assert_eq!(o, Less);
505///
506/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_ref(-10i8, 10);
507/// assert_eq!(shifted.to_string(), "3216.0");
508/// assert_eq!(o, Less);
509///
510/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_prec_ref(u32::MAX, 10);
511/// assert_eq!(shifted.to_string(), "0.0");
512/// assert_eq!(o, Less);
513/// ```
514///
515/// # shr_prec_assign
516/// ```
517/// use malachite_float::Float;
518/// use std::cmp::Ordering::*;
519///
520/// let mut x = Float::from(std::f64::consts::PI);
521/// assert_eq!(x.shr_prec_assign(10u8, 10), Less);
522/// assert_eq!(x.to_string(), "0.0030670");
523///
524/// let mut x = Float::from(std::f64::consts::PI);
525/// assert_eq!(x.shr_prec_assign(-10i8, 10), Less);
526/// assert_eq!(x.to_string(), "3216.0");
527///
528/// let mut x = Float::from(std::f64::consts::PI);
529/// assert_eq!(x.shr_prec_assign(u32::MAX, 10), Less);
530/// assert_eq!(x.to_string(), "0.0");
531/// ```
532///
533/// # shr_round
534/// ```
535/// use malachite_base::num::arithmetic::traits::ShrRound;
536/// use malachite_base::rounding_modes::RoundingMode::*;
537/// use malachite_float::Float;
538/// use std::cmp::Ordering::*;
539///
540/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(10u8, Nearest);
541/// assert_eq!(shifted.to_string(), "0.0030679615757712823");
542/// assert_eq!(o, Equal);
543///
544/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(-10i8, Nearest);
545/// assert_eq!(shifted.to_string(), "3216.9908772759482");
546/// assert_eq!(o, Equal);
547///
548/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(u32::MAX, Floor);
549/// assert_eq!(shifted.to_string(), "0.0");
550/// assert_eq!(o, Less);
551///
552/// let (shifted, o) = Float::from(std::f64::consts::PI).shr_round(u32::MAX, Ceiling);
553/// assert_eq!(shifted.to_string(), "2.3825649048879511e-323228497");
554/// assert_eq!(o, Greater);
555///
556/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(10u8, Nearest);
557/// assert_eq!(shifted.to_string(), "0.0030679615757712823");
558/// assert_eq!(o, Equal);
559///
560/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(-10i8, Nearest);
561/// assert_eq!(shifted.to_string(), "3216.9908772759482");
562/// assert_eq!(o, Equal);
563///
564/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(u32::MAX, Floor);
565/// assert_eq!(shifted.to_string(), "0.0");
566/// assert_eq!(o, Less);
567///
568/// let (shifted, o) = (&Float::from(std::f64::consts::PI)).shr_round(u32::MAX, Ceiling);
569/// assert_eq!(shifted.to_string(), "2.3825649048879511e-323228497");
570/// assert_eq!(o, Greater);
571/// ```
572///
573/// # shr_round_assign
574/// ```
575/// use malachite_base::num::arithmetic::traits::ShrRoundAssign;
576/// use malachite_base::rounding_modes::RoundingMode::*;
577/// use malachite_float::Float;
578/// use std::cmp::Ordering::*;
579///
580/// let mut x = Float::from(std::f64::consts::PI);
581/// assert_eq!(x.shr_round_assign(10u8, Nearest), Equal);
582/// assert_eq!(x.to_string(), "0.0030679615757712823");
583///
584/// let mut x = Float::from(std::f64::consts::PI);
585/// assert_eq!(x.shr_round_assign(-10i8, Nearest), Equal);
586/// assert_eq!(x.to_string(), "3216.9908772759482");
587///
588/// let mut x = Float::from(std::f64::consts::PI);
589/// assert_eq!(x.shr_round_assign(u32::MAX, Floor), Less);
590/// assert_eq!(x.to_string(), "0.0");
591///
592/// let mut x = Float::from(std::f64::consts::PI);
593/// assert_eq!(x.shr_round_assign(u32::MAX, Ceiling), Greater);
594/// assert_eq!(x.to_string(), "2.3825649048879511e-323228497");
595/// ```
596pub mod shr_round;
597/// An implementation of [`Sign`](malachite_base::num::arithmetic::traits::Sign), a trait for
598/// determining the sign of a number.
599pub mod sign;
600/// [`Sqrt`](malachite_base::num::arithmetic::traits::Sqrt) and
601/// [`SqrtAssign`](malachite_base::num::arithmetic::traits::SqrtAssign), traits for computing the
602/// square root of [`Float`](super::Float)s.
603pub mod sqrt;
604/// Squaring of [`Float`](super::Float)s.
605pub mod square;
606/// Subtraction of [`Float`](super::Float)s, of [`Float`](super::Float)s by
607/// [`Rational`](malachite_q::Rational)s, and of [`Rational`](malachite_q::Rational)s by
608/// [`Float`](super::Float)s.
609pub mod sub;