@@ -19,9 +19,91 @@ pub mod consts {}
19
19
20
20
#[ cfg( not( test) ) ]
21
21
impl f128 {
22
- // FIXME(f16_f128): almost everything in this `impl` is missing examples and a const
22
+ // FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const
23
23
// implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE.
24
24
25
+ /// The radix or base of the internal representation of `f128`.
26
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
27
+ pub const RADIX : u32 = 2 ;
28
+
29
+ /// Number of significant digits in base 2.
30
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
31
+ pub const MANTISSA_DIGITS : u32 = 113 ;
32
+
33
+ /// Approximate number of significant digits in base 10.
34
+ ///
35
+ /// This is the maximum <i>x</i> such that any decimal number with <i>x</i>
36
+ /// significant digits can be converted to `f128` and back without loss.
37
+ ///
38
+ /// Equal to floor(log<sub>10</sub> 2<sup>[`MANTISSA_DIGITS`] − 1</sup>).
39
+ ///
40
+ /// [`MANTISSA_DIGITS`]: f128::MANTISSA_DIGITS
41
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
42
+ pub const DIGITS : u32 = 33 ;
43
+
44
+ /// [Machine epsilon] value for `f128`.
45
+ ///
46
+ /// This is the difference between `1.0` and the next larger representable number.
47
+ ///
48
+ /// Equal to 2<sup>1 − [`MANTISSA_DIGITS`]</sup>.
49
+ ///
50
+ /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
51
+ /// [`MANTISSA_DIGITS`]: f128::MANTISSA_DIGITS
52
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
53
+ pub const EPSILON : f128 = 1.92592994438723585305597794258492731e-34_f128 ;
54
+
55
+ /// Smallest finite `f128` value.
56
+ ///
57
+ /// Equal to −[`MAX`].
58
+ ///
59
+ /// [`MAX`]: f128::MAX
60
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
61
+ pub const MIN : f128 = -1.18973149535723176508575932662800701e+4932_f128 ;
62
+ /// Smallest positive normal `f128` value.
63
+ ///
64
+ /// Equal to 2<sup>[`MIN_EXP`] − 1</sup>.
65
+ ///
66
+ /// [`MIN_EXP`]: f128::MIN_EXP
67
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
68
+ pub const MIN_POSITIVE : f128 = 3.36210314311209350626267781732175260e-4932_f128 ;
69
+ /// Largest finite `f128` value.
70
+ ///
71
+ /// Equal to
72
+ /// (1 − 2<sup>−[`MANTISSA_DIGITS`]</sup>) 2<sup>[`MAX_EXP`]</sup>.
73
+ ///
74
+ /// [`MANTISSA_DIGITS`]: f128::MANTISSA_DIGITS
75
+ /// [`MAX_EXP`]: f128::MAX_EXP
76
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
77
+ pub const MAX : f128 = 1.18973149535723176508575932662800701e+4932_f128 ;
78
+
79
+ /// One greater than the minimum possible normal power of 2 exponent.
80
+ ///
81
+ /// If <i>x</i> = `MIN_EXP`, then normal numbers
82
+ /// ≥ 0.5 × 2<sup><i>x</i></sup>.
83
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
84
+ pub const MIN_EXP : i32 = -16_381 ;
85
+ /// Maximum possible power of 2 exponent.
86
+ ///
87
+ /// If <i>x</i> = `MAX_EXP`, then normal numbers
88
+ /// < 1 × 2<sup><i>x</i></sup>.
89
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
90
+ pub const MAX_EXP : i32 = 16_384 ;
91
+
92
+ /// Minimum <i>x</i> for which 10<sup><i>x</i></sup> is normal.
93
+ ///
94
+ /// Equal to ceil(log<sub>10</sub> [`MIN_POSITIVE`]).
95
+ ///
96
+ /// [`MIN_POSITIVE`]: f128::MIN_POSITIVE
97
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
98
+ pub const MIN_10_EXP : i32 = -4_931 ;
99
+ /// Maximum <i>x</i> for which 10<sup><i>x</i></sup> is normal.
100
+ ///
101
+ /// Equal to floor(log<sub>10</sub> [`MAX`]).
102
+ ///
103
+ /// [`MAX`]: f128::MAX
104
+ #[ unstable( feature = "f128" , issue = "116909" ) ]
105
+ pub const MAX_10_EXP : i32 = 4_932 ;
106
+
25
107
/// Returns `true` if this value is NaN.
26
108
#[ inline]
27
109
#[ must_use]
0 commit comments