Skip to content

Commit 8efd990

Browse files
committed
auto merge of #20573 : huonw/rust/num-stab-2, r=alexcrichton
cc #19260 Open questions: - I still feel weird about marking functions like `exp` as `#[stable]` in `core` since they're highly likely to call into libm which is theoretically something core is designed to avoid and so we may be forced/want to move it at some point in the future, and so it feels like a lie to call it `#[stable]` (I know `core` is `#[experimental]`, but still...) - `abs_sub` is a horrible name IMO: it feels like it is `(a - b).abs()`, but it is actually `(a - b).max(0.)`. maybe something along the lines of `pos_diff` ("positive difference") is better. - the associated-function nature of `Int::from_be` and `Int::from_le` feel strange to me, it feels like they should be methods, but I cannot think of a good name. I'm also not hugely in favour of `ldexp` and `frexp` but the precedent from C is large. (e.g. AFAICT, `ldexp` must mean "load exponent" which is essentially what it does... but only for a subset of its inputs.)
2 parents 340ac04 + f3a80ab commit 8efd990

File tree

10 files changed

+570
-83
lines changed

10 files changed

+570
-83
lines changed

src/libcore/num/f32.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ use num::Float;
2222
use num::FpCategory as Fp;
2323
use option::Option;
2424

25-
#[stable]
25+
#[unstable = "pending integer conventions"]
2626
pub const RADIX: uint = 2u;
2727

28-
#[stable]
28+
#[unstable = "pending integer conventions"]
2929
pub const MANTISSA_DIGITS: uint = 24u;
30-
#[stable]
30+
#[unstable = "pending integer conventions"]
3131
pub const DIGITS: uint = 6u;
3232

3333
#[stable]
@@ -43,14 +43,14 @@ pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
4343
#[stable]
4444
pub const MAX_VALUE: f32 = 3.40282347e+38_f32;
4545

46-
#[stable]
46+
#[unstable = "pending integer conventions"]
4747
pub const MIN_EXP: int = -125;
48-
#[stable]
48+
#[unstable = "pending integer conventions"]
4949
pub const MAX_EXP: int = 128;
5050

51-
#[stable]
51+
#[unstable = "pending integer conventions"]
5252
pub const MIN_10_EXP: int = -37;
53-
#[stable]
53+
#[unstable = "pending integer conventions"]
5454
pub const MAX_10_EXP: int = 38;
5555

5656
#[stable]
@@ -177,33 +177,43 @@ impl Float for f32 {
177177
}
178178

179179
#[inline]
180+
#[deprecated]
180181
fn mantissa_digits(_: Option<f32>) -> uint { MANTISSA_DIGITS }
181182

182183
#[inline]
184+
#[deprecated]
183185
fn digits(_: Option<f32>) -> uint { DIGITS }
184186

185187
#[inline]
188+
#[deprecated]
186189
fn epsilon() -> f32 { EPSILON }
187190

188191
#[inline]
192+
#[deprecated]
189193
fn min_exp(_: Option<f32>) -> int { MIN_EXP }
190194

191195
#[inline]
196+
#[deprecated]
192197
fn max_exp(_: Option<f32>) -> int { MAX_EXP }
193198

194199
#[inline]
200+
#[deprecated]
195201
fn min_10_exp(_: Option<f32>) -> int { MIN_10_EXP }
196202

197203
#[inline]
204+
#[deprecated]
198205
fn max_10_exp(_: Option<f32>) -> int { MAX_10_EXP }
199206

200207
#[inline]
208+
#[deprecated]
201209
fn min_value() -> f32 { MIN_VALUE }
202210

203211
#[inline]
212+
#[deprecated]
204213
fn min_pos_value(_: Option<f32>) -> f32 { MIN_POS_VALUE }
205214

206215
#[inline]
216+
#[deprecated]
207217
fn max_value() -> f32 { MAX_VALUE }
208218

209219
/// Returns the mantissa, exponent and sign as integers.

src/libcore/num/f64.rs

+16-7
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ use option::Option;
2626
// constants are implemented in favour of referencing the respective
2727
// members of `Bounded` and `Float`.
2828

29-
#[stable]
29+
#[unstable = "pending integer conventions"]
3030
pub const RADIX: uint = 2u;
3131

32-
#[stable]
3332
pub const MANTISSA_DIGITS: uint = 53u;
34-
#[stable]
33+
#[unstable = "pending integer conventions"]
3534
pub const DIGITS: uint = 15u;
3635

3736
#[stable]
@@ -47,14 +46,14 @@ pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
4746
#[stable]
4847
pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
4948

50-
#[stable]
49+
#[unstable = "pending integer conventions"]
5150
pub const MIN_EXP: int = -1021;
52-
#[stable]
51+
#[unstable = "pending integer conventions"]
5352
pub const MAX_EXP: int = 1024;
5453

55-
#[stable]
54+
#[unstable = "pending integer conventions"]
5655
pub const MIN_10_EXP: int = -307;
57-
#[stable]
56+
#[unstable = "pending integer conventions"]
5857
pub const MAX_10_EXP: int = 308;
5958

6059
#[stable]
@@ -185,33 +184,43 @@ impl Float for f64 {
185184
}
186185

187186
#[inline]
187+
#[deprecated]
188188
fn mantissa_digits(_: Option<f64>) -> uint { MANTISSA_DIGITS }
189189

190190
#[inline]
191+
#[deprecated]
191192
fn digits(_: Option<f64>) -> uint { DIGITS }
192193

193194
#[inline]
195+
#[deprecated]
194196
fn epsilon() -> f64 { EPSILON }
195197

196198
#[inline]
199+
#[deprecated]
197200
fn min_exp(_: Option<f64>) -> int { MIN_EXP }
198201

199202
#[inline]
203+
#[deprecated]
200204
fn max_exp(_: Option<f64>) -> int { MAX_EXP }
201205

202206
#[inline]
207+
#[deprecated]
203208
fn min_10_exp(_: Option<f64>) -> int { MIN_10_EXP }
204209

205210
#[inline]
211+
#[deprecated]
206212
fn max_10_exp(_: Option<f64>) -> int { MAX_10_EXP }
207213

208214
#[inline]
215+
#[deprecated]
209216
fn min_value() -> f64 { MIN_VALUE }
210217

211218
#[inline]
219+
#[deprecated]
212220
fn min_pos_value(_: Option<f64>) -> f64 { MIN_POS_VALUE }
213221

214222
#[inline]
223+
#[deprecated]
215224
fn max_value() -> f64 { MAX_VALUE }
216225

217226
/// Returns the mantissa, exponent and sign as integers.

0 commit comments

Comments
 (0)