Skip to content

Commit 691ee0b

Browse files
authored
Rollup merge of rust-lang#34277 - ollie27:docs_num, r=steveklabnik
Add/improve num const docs This adds short summaries to all num consts. r? @steveklabnik
2 parents 7b6671d + 2dcfa62 commit 691ee0b

File tree

5 files changed

+64
-65
lines changed

5 files changed

+64
-65
lines changed

src/libcore/num/f32.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,121 +20,121 @@ use mem;
2020
use num::Float;
2121
use num::FpCategory as Fp;
2222

23+
/// The radix or base of the internal representation of `f32`.
2324
#[stable(feature = "rust1", since = "1.0.0")]
24-
#[allow(missing_docs)]
2525
pub const RADIX: u32 = 2;
2626

27+
/// Number of significant digits in base 2.
2728
#[stable(feature = "rust1", since = "1.0.0")]
28-
#[allow(missing_docs)]
2929
pub const MANTISSA_DIGITS: u32 = 24;
30+
/// Approximate number of significant digits in base 10.
3031
#[stable(feature = "rust1", since = "1.0.0")]
31-
#[allow(missing_docs)]
3232
pub const DIGITS: u32 = 6;
3333

34+
/// Difference between `1.0` and the next largest representable number.
3435
#[stable(feature = "rust1", since = "1.0.0")]
35-
#[allow(missing_docs)]
3636
pub const EPSILON: f32 = 1.19209290e-07_f32;
3737

38-
/// Smallest finite f32 value
38+
/// Smallest finite `f32` value.
3939
#[stable(feature = "rust1", since = "1.0.0")]
4040
pub const MIN: f32 = -3.40282347e+38_f32;
41-
/// Smallest positive, normalized f32 value
41+
/// Smallest positive normal `f32` value.
4242
#[stable(feature = "rust1", since = "1.0.0")]
4343
pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32;
44-
/// Largest finite f32 value
44+
/// Largest finite `f32` value.
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
pub const MAX: f32 = 3.40282347e+38_f32;
4747

48+
/// One greater than the minimum possible normal power of 2 exponent.
4849
#[stable(feature = "rust1", since = "1.0.0")]
49-
#[allow(missing_docs)]
5050
pub const MIN_EXP: i32 = -125;
51+
/// Maximum possible power of 2 exponent.
5152
#[stable(feature = "rust1", since = "1.0.0")]
52-
#[allow(missing_docs)]
5353
pub const MAX_EXP: i32 = 128;
5454

55+
/// Minimum possible normal power of 10 exponent.
5556
#[stable(feature = "rust1", since = "1.0.0")]
56-
#[allow(missing_docs)]
5757
pub const MIN_10_EXP: i32 = -37;
58+
/// Maximum possible power of 10 exponent.
5859
#[stable(feature = "rust1", since = "1.0.0")]
59-
#[allow(missing_docs)]
6060
pub const MAX_10_EXP: i32 = 38;
6161

62+
/// Not a Number (NaN).
6263
#[stable(feature = "rust1", since = "1.0.0")]
63-
#[allow(missing_docs)]
6464
pub const NAN: f32 = 0.0_f32/0.0_f32;
65+
/// Infinity (∞).
6566
#[stable(feature = "rust1", since = "1.0.0")]
66-
#[allow(missing_docs)]
6767
pub const INFINITY: f32 = 1.0_f32/0.0_f32;
68+
/// Negative infinity (-∞).
6869
#[stable(feature = "rust1", since = "1.0.0")]
69-
#[allow(missing_docs)]
7070
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
7171

7272
/// Basic mathematical constants.
7373
#[stable(feature = "rust1", since = "1.0.0")]
7474
pub mod consts {
7575
// FIXME: replace with mathematical constants from cmath.
7676

77-
/// Archimedes' constant
77+
/// Archimedes' constant (π)
7878
#[stable(feature = "rust1", since = "1.0.0")]
7979
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
8080

81-
/// pi/2.0
81+
/// π/2
8282
#[stable(feature = "rust1", since = "1.0.0")]
8383
pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
8484

85-
/// pi/3.0
85+
/// π/3
8686
#[stable(feature = "rust1", since = "1.0.0")]
8787
pub const FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
8888

89-
/// pi/4.0
89+
/// π/4
9090
#[stable(feature = "rust1", since = "1.0.0")]
9191
pub const FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
9292

93-
/// pi/6.0
93+
/// π/6
9494
#[stable(feature = "rust1", since = "1.0.0")]
9595
pub const FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
9696

97-
/// pi/8.0
97+
/// π/8
9898
#[stable(feature = "rust1", since = "1.0.0")]
9999
pub const FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
100100

101-
/// 1.0/pi
101+
/// 1
102102
#[stable(feature = "rust1", since = "1.0.0")]
103103
pub const FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
104104

105-
/// 2.0/pi
105+
/// 2
106106
#[stable(feature = "rust1", since = "1.0.0")]
107107
pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
108108

109-
/// 2.0/sqrt(pi)
109+
/// 2/sqrt(π)
110110
#[stable(feature = "rust1", since = "1.0.0")]
111111
pub const FRAC_2_SQRT_PI: f32 = 1.12837916709551257389615890312154517_f32;
112112

113-
/// sqrt(2.0)
113+
/// sqrt(2)
114114
#[stable(feature = "rust1", since = "1.0.0")]
115115
pub const SQRT_2: f32 = 1.41421356237309504880168872420969808_f32;
116116

117-
/// 1.0/sqrt(2.0)
117+
/// 1/sqrt(2)
118118
#[stable(feature = "rust1", since = "1.0.0")]
119119
pub const FRAC_1_SQRT_2: f32 = 0.707106781186547524400844362104849039_f32;
120120

121-
/// Euler's number
121+
/// Euler's number (e)
122122
#[stable(feature = "rust1", since = "1.0.0")]
123123
pub const E: f32 = 2.71828182845904523536028747135266250_f32;
124124

125-
/// log2(e)
125+
/// log<sub>2</sub>(e)
126126
#[stable(feature = "rust1", since = "1.0.0")]
127127
pub const LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
128128

129-
/// log10(e)
129+
/// log<sub>10</sub>(e)
130130
#[stable(feature = "rust1", since = "1.0.0")]
131131
pub const LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
132132

133-
/// ln(2.0)
133+
/// ln(2)
134134
#[stable(feature = "rust1", since = "1.0.0")]
135135
pub const LN_2: f32 = 0.693147180559945309417232121458176568_f32;
136136

137-
/// ln(10.0)
137+
/// ln(10)
138138
#[stable(feature = "rust1", since = "1.0.0")]
139139
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
140140
}

src/libcore/num/f64.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,121 +20,121 @@ use mem;
2020
use num::FpCategory as Fp;
2121
use num::Float;
2222

23+
/// The radix or base of the internal representation of `f64`.
2324
#[stable(feature = "rust1", since = "1.0.0")]
24-
#[allow(missing_docs)]
2525
pub const RADIX: u32 = 2;
2626

27+
/// Number of significant digits in base 2.
2728
#[stable(feature = "rust1", since = "1.0.0")]
28-
#[allow(missing_docs)]
2929
pub const MANTISSA_DIGITS: u32 = 53;
30+
/// Approximate number of significant digits in base 10.
3031
#[stable(feature = "rust1", since = "1.0.0")]
31-
#[allow(missing_docs)]
3232
pub const DIGITS: u32 = 15;
3333

34+
/// Difference between `1.0` and the next largest representable number.
3435
#[stable(feature = "rust1", since = "1.0.0")]
35-
#[allow(missing_docs)]
3636
pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
3737

38-
/// Smallest finite f64 value
38+
/// Smallest finite `f64` value.
3939
#[stable(feature = "rust1", since = "1.0.0")]
4040
pub const MIN: f64 = -1.7976931348623157e+308_f64;
41-
/// Smallest positive, normalized f64 value
41+
/// Smallest positive normal `f64` value.
4242
#[stable(feature = "rust1", since = "1.0.0")]
4343
pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64;
44-
/// Largest finite f64 value
44+
/// Largest finite `f64` value.
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
pub const MAX: f64 = 1.7976931348623157e+308_f64;
4747

48+
/// One greater than the minimum possible normal power of 2 exponent.
4849
#[stable(feature = "rust1", since = "1.0.0")]
49-
#[allow(missing_docs)]
5050
pub const MIN_EXP: i32 = -1021;
51+
/// Maximum possible power of 2 exponent.
5152
#[stable(feature = "rust1", since = "1.0.0")]
52-
#[allow(missing_docs)]
5353
pub const MAX_EXP: i32 = 1024;
5454

55+
/// Minimum possible normal power of 10 exponent.
5556
#[stable(feature = "rust1", since = "1.0.0")]
56-
#[allow(missing_docs)]
5757
pub const MIN_10_EXP: i32 = -307;
58+
/// Maximum possible power of 10 exponent.
5859
#[stable(feature = "rust1", since = "1.0.0")]
59-
#[allow(missing_docs)]
6060
pub const MAX_10_EXP: i32 = 308;
6161

62+
/// Not a Number (NaN).
6263
#[stable(feature = "rust1", since = "1.0.0")]
63-
#[allow(missing_docs)]
6464
pub const NAN: f64 = 0.0_f64/0.0_f64;
65+
/// Infinity (∞).
6566
#[stable(feature = "rust1", since = "1.0.0")]
66-
#[allow(missing_docs)]
6767
pub const INFINITY: f64 = 1.0_f64/0.0_f64;
68+
/// Negative infinity (-∞).
6869
#[stable(feature = "rust1", since = "1.0.0")]
69-
#[allow(missing_docs)]
7070
pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
7171

7272
/// Basic mathematical constants.
7373
#[stable(feature = "rust1", since = "1.0.0")]
7474
pub mod consts {
7575
// FIXME: replace with mathematical constants from cmath.
7676

77-
/// Archimedes' constant
77+
/// Archimedes' constant (π)
7878
#[stable(feature = "rust1", since = "1.0.0")]
7979
pub const PI: f64 = 3.14159265358979323846264338327950288_f64;
8080

81-
/// pi/2.0
81+
/// π/2
8282
#[stable(feature = "rust1", since = "1.0.0")]
8383
pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
8484

85-
/// pi/3.0
85+
/// π/3
8686
#[stable(feature = "rust1", since = "1.0.0")]
8787
pub const FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
8888

89-
/// pi/4.0
89+
/// π/4
9090
#[stable(feature = "rust1", since = "1.0.0")]
9191
pub const FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
9292

93-
/// pi/6.0
93+
/// π/6
9494
#[stable(feature = "rust1", since = "1.0.0")]
9595
pub const FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
9696

97-
/// pi/8.0
97+
/// π/8
9898
#[stable(feature = "rust1", since = "1.0.0")]
9999
pub const FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
100100

101-
/// 1.0/pi
101+
/// 1
102102
#[stable(feature = "rust1", since = "1.0.0")]
103103
pub const FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
104104

105-
/// 2.0/pi
105+
/// 2
106106
#[stable(feature = "rust1", since = "1.0.0")]
107107
pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
108108

109-
/// 2.0/sqrt(pi)
109+
/// 2/sqrt(π)
110110
#[stable(feature = "rust1", since = "1.0.0")]
111111
pub const FRAC_2_SQRT_PI: f64 = 1.12837916709551257389615890312154517_f64;
112112

113-
/// sqrt(2.0)
113+
/// sqrt(2)
114114
#[stable(feature = "rust1", since = "1.0.0")]
115115
pub const SQRT_2: f64 = 1.41421356237309504880168872420969808_f64;
116116

117-
/// 1.0/sqrt(2.0)
117+
/// 1/sqrt(2)
118118
#[stable(feature = "rust1", since = "1.0.0")]
119119
pub const FRAC_1_SQRT_2: f64 = 0.707106781186547524400844362104849039_f64;
120120

121-
/// Euler's number
121+
/// Euler's number (e)
122122
#[stable(feature = "rust1", since = "1.0.0")]
123123
pub const E: f64 = 2.71828182845904523536028747135266250_f64;
124124

125-
/// log2(e)
125+
/// log<sub>2</sub>(e)
126126
#[stable(feature = "rust1", since = "1.0.0")]
127127
pub const LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
128128

129-
/// log10(e)
129+
/// log<sub>10</sub>(e)
130130
#[stable(feature = "rust1", since = "1.0.0")]
131131
pub const LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
132132

133-
/// ln(2.0)
133+
/// ln(2)
134134
#[stable(feature = "rust1", since = "1.0.0")]
135135
pub const LN_2: f64 = 0.693147180559945309417232121458176568_f64;
136136

137-
/// ln(10.0)
137+
/// ln(10)
138138
#[stable(feature = "rust1", since = "1.0.0")]
139139
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
140140
}

src/libcore/num/int_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
macro_rules! int_module { ($T:ident, $bits:expr) => (
1414

15+
/// The smallest value that can be represented by this integer type.
1516
#[stable(feature = "rust1", since = "1.0.0")]
16-
#[allow(missing_docs)]
1717
pub const MIN: $T = $T::min_value();
18+
/// The largest value that can be represented by this integer type.
1819
#[stable(feature = "rust1", since = "1.0.0")]
19-
#[allow(missing_docs)]
2020
pub const MAX: $T = $T::max_value();
2121

2222
) }

src/libcore/num/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! Numeric traits and functions for the built-in numeric types.
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
14-
#![allow(missing_docs)]
1514

1615
use char::CharExt;
1716
use cmp::PartialOrd;

src/libcore/num/uint_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
macro_rules! uint_module { ($T:ident, $bits:expr) => (
1414

15+
/// The smallest value that can be represented by this integer type.
1516
#[stable(feature = "rust1", since = "1.0.0")]
16-
#[allow(missing_docs)]
1717
pub const MIN: $T = $T::min_value();
18+
/// The largest value that can be represented by this integer type.
1819
#[stable(feature = "rust1", since = "1.0.0")]
19-
#[allow(missing_docs)]
2020
pub const MAX: $T = $T::max_value();
2121

2222
) }

0 commit comments

Comments
 (0)