@@ -197,16 +197,22 @@ impl f128 {
197
197
#[ unstable( feature = "f128" , issue = "116909" ) ]
198
198
pub const MAX : f128 = 1.18973149535723176508575932662800702e+4932_f128 ;
199
199
200
- /// One greater than the minimum possible normal power of 2 exponent.
200
+ /// One greater than the minimum possible *normal* power of 2 exponent
201
+ /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
201
202
///
202
- /// If <i>x</i> = `MIN_EXP`, then normal numbers
203
- /// ≥ 0.5 × 2<sup><i>x</i></sup>.
203
+ /// This corresponds to the exact minimum possible *normal* power of 2 exponent
204
+ /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
205
+ /// In other words, all normal numbers representable by this type are
206
+ /// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>.
204
207
#[ unstable( feature = "f128" , issue = "116909" ) ]
205
208
pub const MIN_EXP : i32 = -16_381 ;
206
- /// Maximum possible power of 2 exponent.
209
+ /// One greater than the maximum possible power of 2 exponent
210
+ /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
207
211
///
208
- /// If <i>x</i> = `MAX_EXP`, then normal numbers
209
- /// < 1 × 2<sup><i>x</i></sup>.
212
+ /// This corresponds to the exact maximum possible power of 2 exponent
213
+ /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
214
+ /// In other words, all numbers representable by this type are
215
+ /// strictly less than 2<sup><i>MAX_EXP</i></sup>.
210
216
#[ unstable( feature = "f128" , issue = "116909" ) ]
211
217
pub const MAX_EXP : i32 = 16_384 ;
212
218
@@ -804,7 +810,7 @@ impl f128 {
804
810
}
805
811
}
806
812
807
- /// Calculates the middle point of `self` and `rhs`.
813
+ /// Calculates the midpoint (average) between `self` and `rhs`.
808
814
///
809
815
/// This returns NaN when *either* argument is NaN or if a combination of
810
816
/// +inf and -inf is provided as arguments.
@@ -821,6 +827,7 @@ impl f128 {
821
827
/// # }
822
828
/// ```
823
829
#[ inline]
830
+ #[ doc( alias = "average" ) ]
824
831
#[ unstable( feature = "f128" , issue = "116909" ) ]
825
832
#[ rustc_const_unstable( feature = "f128" , issue = "116909" ) ]
826
833
pub const fn midpoint ( self , other : f128 ) -> f128 {
@@ -903,6 +910,7 @@ impl f128 {
903
910
#[ inline]
904
911
#[ unstable( feature = "f128" , issue = "116909" ) ]
905
912
#[ must_use = "this returns the result of the operation, without modifying the original" ]
913
+ #[ cfg_attr( not( bootstrap) , allow( unnecessary_transmutes) ) ]
906
914
pub const fn to_bits ( self ) -> u128 {
907
915
// SAFETY: `u128` is a plain old datatype so we can always transmute to it.
908
916
unsafe { mem:: transmute ( self ) }
@@ -950,6 +958,7 @@ impl f128 {
950
958
#[ inline]
951
959
#[ must_use]
952
960
#[ unstable( feature = "f128" , issue = "116909" ) ]
961
+ #[ cfg_attr( not( bootstrap) , allow( unnecessary_transmutes) ) ]
953
962
pub const fn from_bits ( v : u128 ) -> Self {
954
963
// It turns out the safety issues with sNaN were overblown! Hooray!
955
964
// SAFETY: `u128` is a plain old datatype so we can always transmute from it.
@@ -1373,8 +1382,9 @@ impl f128 {
1373
1382
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
1374
1383
#[ must_use = "method returns a new number and does not mutate the original value" ]
1375
1384
#[ unstable( feature = "float_algebraic" , issue = "136469" ) ]
1385
+ #[ rustc_const_unstable( feature = "float_algebraic" , issue = "136469" ) ]
1376
1386
#[ inline]
1377
- pub fn algebraic_add ( self , rhs : f128 ) -> f128 {
1387
+ pub const fn algebraic_add ( self , rhs : f128 ) -> f128 {
1378
1388
intrinsics:: fadd_algebraic ( self , rhs)
1379
1389
}
1380
1390
@@ -1383,8 +1393,9 @@ impl f128 {
1383
1393
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
1384
1394
#[ must_use = "method returns a new number and does not mutate the original value" ]
1385
1395
#[ unstable( feature = "float_algebraic" , issue = "136469" ) ]
1396
+ #[ rustc_const_unstable( feature = "float_algebraic" , issue = "136469" ) ]
1386
1397
#[ inline]
1387
- pub fn algebraic_sub ( self , rhs : f128 ) -> f128 {
1398
+ pub const fn algebraic_sub ( self , rhs : f128 ) -> f128 {
1388
1399
intrinsics:: fsub_algebraic ( self , rhs)
1389
1400
}
1390
1401
@@ -1393,8 +1404,9 @@ impl f128 {
1393
1404
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
1394
1405
#[ must_use = "method returns a new number and does not mutate the original value" ]
1395
1406
#[ unstable( feature = "float_algebraic" , issue = "136469" ) ]
1407
+ #[ rustc_const_unstable( feature = "float_algebraic" , issue = "136469" ) ]
1396
1408
#[ inline]
1397
- pub fn algebraic_mul ( self , rhs : f128 ) -> f128 {
1409
+ pub const fn algebraic_mul ( self , rhs : f128 ) -> f128 {
1398
1410
intrinsics:: fmul_algebraic ( self , rhs)
1399
1411
}
1400
1412
@@ -1403,8 +1415,9 @@ impl f128 {
1403
1415
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
1404
1416
#[ must_use = "method returns a new number and does not mutate the original value" ]
1405
1417
#[ unstable( feature = "float_algebraic" , issue = "136469" ) ]
1418
+ #[ rustc_const_unstable( feature = "float_algebraic" , issue = "136469" ) ]
1406
1419
#[ inline]
1407
- pub fn algebraic_div ( self , rhs : f128 ) -> f128 {
1420
+ pub const fn algebraic_div ( self , rhs : f128 ) -> f128 {
1408
1421
intrinsics:: fdiv_algebraic ( self , rhs)
1409
1422
}
1410
1423
@@ -1413,8 +1426,9 @@ impl f128 {
1413
1426
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
1414
1427
#[ must_use = "method returns a new number and does not mutate the original value" ]
1415
1428
#[ unstable( feature = "float_algebraic" , issue = "136469" ) ]
1429
+ #[ rustc_const_unstable( feature = "float_algebraic" , issue = "136469" ) ]
1416
1430
#[ inline]
1417
- pub fn algebraic_rem ( self , rhs : f128 ) -> f128 {
1431
+ pub const fn algebraic_rem ( self , rhs : f128 ) -> f128 {
1418
1432
intrinsics:: frem_algebraic ( self , rhs)
1419
1433
}
1420
1434
}
0 commit comments