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
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore extendedbigdecimal
use Zero;
use ExtendedBigDecimal;
/// A number with a specified number of integer and fractional digits.
///
/// This struct can be used to represent a number along with information
/// on how many significant digits to use when displaying the number.
/// The [`PreciseNumber::num_integral_digits`] field also includes the width needed to
/// display the "-" character for a negative number.
/// [`PreciseNumber::num_fractional_digits`] provides the number of decimal digits after
/// the decimal point (a.k.a. precision), or None if that number cannot intuitively be
/// obtained (i.e. hexadecimal floats).
/// Note: Those 2 fields should not necessarily be interpreted literally, but as matching
/// GNU `seq` behavior: the exact way of guessing desired precision from user input is a
/// matter of interpretation.
///
/// You can get an instance of this struct by calling [`str::parse`].