Skip to content
This repository was archived by the owner on Nov 14, 2022. It is now read-only.

Commit 25b0b6c

Browse files
committed
Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments This has been factored out from rust-lang/rust#58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far! [git filter-repo] original commit: rust-lang/rust@b244f61
2 parents e40eab0 + 0537f06 commit 25b0b6c

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

ieee.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl Semantics for X87DoubleExtendedS {
186186
/// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity")
187187
/// exponent = all 1's, integer bit 0, significand nonzero ("pseudoNaN")
188188
/// exponent = 0, integer bit 1 ("pseudodenormal")
189-
/// exponent!=0 nor all 1's, integer bit 0 ("unnormal")
189+
/// exponent != 0 nor all 1's, integer bit 0 ("unnormal")
190190
/// At the moment, the first two are treated as NaNs, the second two as Normal.
191191
fn from_bits(bits: u128) -> IeeeFloat<Self> {
192192
let sign = bits & (1 << (Self::BITS - 1));
@@ -1549,11 +1549,11 @@ impl<S: Semantics> IeeeFloat<S> {
15491549
}
15501550
}
15511551

1552-
/// Returns TRUE if, when truncating the current number, with BIT the
1552+
/// Returns `true` if, when truncating the current number, with `bit` the
15531553
/// new LSB, with the given lost fraction and rounding mode, the result
15541554
/// would need to be rounded away from zero (i.e., by increasing the
1555-
/// signficand). This routine must work for Category::Zero of both signs, and
1556-
/// Category::Normal numbers.
1555+
/// signficand). This routine must work for `Category::Zero` of both signs, and
1556+
/// `Category::Normal` numbers.
15571557
fn round_away_from_zero(&self, round: Round, loss: Loss, bit: usize) -> bool {
15581558
// NaNs and infinities should not have lost fractions.
15591559
assert!(self.is_finite_non_zero() || self.is_zero());
@@ -2257,7 +2257,7 @@ impl Loss {
22572257
more_significant
22582258
}
22592259

2260-
/// Return the fraction lost were a bignum truncated losing the least
2260+
/// Returns the fraction lost were a bignum truncated losing the least
22612261
/// significant `bits` bits.
22622262
fn through_truncation(limbs: &[Limb], bits: usize) -> Loss {
22632263
if bits == 0 {
@@ -2320,12 +2320,12 @@ mod sig {
23202320
Ordering::Equal
23212321
}
23222322

2323-
/// Extract the given bit.
2323+
/// Extracts the given bit.
23242324
pub(super) fn get_bit(limbs: &[Limb], bit: usize) -> bool {
23252325
limbs[bit / LIMB_BITS] & (1 << (bit % LIMB_BITS)) != 0
23262326
}
23272327

2328-
/// Set the given bit.
2328+
/// Sets the given bit.
23292329
pub(super) fn set_bit(limbs: &mut [Limb], bit: usize) {
23302330
limbs[bit / LIMB_BITS] |= 1 << (bit % LIMB_BITS);
23312331
}
@@ -2335,7 +2335,7 @@ mod sig {
23352335
limbs[bit / LIMB_BITS] &= !(1 << (bit % LIMB_BITS));
23362336
}
23372337

2338-
/// Shift `dst` left `bits` bits, subtract `bits` from its exponent.
2338+
/// Shifts `dst` left `bits` bits, subtract `bits` from its exponent.
23392339
pub(super) fn shift_left(dst: &mut [Limb], exp: &mut ExpInt, bits: usize) {
23402340
if bits > 0 {
23412341
// Our exponent should not underflow.
@@ -2367,7 +2367,7 @@ mod sig {
23672367
}
23682368
}
23692369

2370-
/// Shift `dst` right `bits` bits noting lost fraction.
2370+
/// Shifts `dst` right `bits` bits noting lost fraction.
23712371
pub(super) fn shift_right(dst: &mut [Limb], exp: &mut ExpInt, bits: usize) -> Loss {
23722372
let loss = Loss::through_truncation(dst, bits);
23732373

@@ -2403,7 +2403,7 @@ mod sig {
24032403
loss
24042404
}
24052405

2406-
/// Copy the bit vector of width `src_bits` from `src`, starting at bit SRC_LSB,
2406+
/// Copies the bit vector of width `src_bits` from `src`, starting at bit SRC_LSB,
24072407
/// to `dst`, such that the bit SRC_LSB becomes the least significant bit of `dst`.
24082408
/// All high bits above `src_bits` in `dst` are zero-filled.
24092409
pub(super) fn extract(dst: &mut [Limb], src: &[Limb], src_bits: usize, src_lsb: usize) {

lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ pub trait Float
375375
fn from_str_r(s: &str, round: Round) -> Result<StatusAnd<Self>, ParseError>;
376376
fn to_bits(self) -> u128;
377377

378-
/// Convert a floating point number to an integer according to the
378+
/// Converts a floating point number to an integer according to the
379379
/// rounding mode. In case of an invalid operation exception,
380380
/// deterministic values are returned, namely zero for NaNs and the
381381
/// minimal or maximal value respectively for underflow or overflow.
@@ -388,7 +388,7 @@ pub trait Float
388388
///
389389
/// The *is_exact output tells whether the result is exact, in the sense
390390
/// that converting it back to the original floating point type produces
391-
/// the original value. This is almost equivalent to result==Status::OK,
391+
/// the original value. This is almost equivalent to `result == Status::OK`,
392392
/// except for negative zeroes.
393393
fn to_i128_r(self, width: usize, round: Round, is_exact: &mut bool) -> StatusAnd<i128> {
394394
let status;
@@ -458,48 +458,48 @@ pub trait Float
458458
}
459459
}
460460

461-
/// IEEE-754R isSignMinus: Returns true if and only if the current value is
461+
/// IEEE-754R isSignMinus: Returns whether the current value is
462462
/// negative.
463463
///
464464
/// This applies to zeros and NaNs as well.
465465
fn is_negative(self) -> bool;
466466

467-
/// IEEE-754R isNormal: Returns true if and only if the current value is normal.
467+
/// IEEE-754R isNormal: Returns whether the current value is normal.
468468
///
469469
/// This implies that the current value of the float is not zero, subnormal,
470470
/// infinite, or NaN following the definition of normality from IEEE-754R.
471471
fn is_normal(self) -> bool {
472472
!self.is_denormal() && self.is_finite_non_zero()
473473
}
474474

475-
/// Returns true if and only if the current value is zero, subnormal, or
475+
/// Returns `true` if the current value is zero, subnormal, or
476476
/// normal.
477477
///
478478
/// This means that the value is not infinite or NaN.
479479
fn is_finite(self) -> bool {
480480
!self.is_nan() && !self.is_infinite()
481481
}
482482

483-
/// Returns true if and only if the float is plus or minus zero.
483+
/// Returns `true` if the float is plus or minus zero.
484484
fn is_zero(self) -> bool {
485485
self.category() == Category::Zero
486486
}
487487

488-
/// IEEE-754R isSubnormal(): Returns true if and only if the float is a
488+
/// IEEE-754R isSubnormal(): Returns whether the float is a
489489
/// denormal.
490490
fn is_denormal(self) -> bool;
491491

492-
/// IEEE-754R isInfinite(): Returns true if and only if the float is infinity.
492+
/// IEEE-754R isInfinite(): Returns whether the float is infinity.
493493
fn is_infinite(self) -> bool {
494494
self.category() == Category::Infinity
495495
}
496496

497-
/// Returns true if and only if the float is a quiet or signaling NaN.
497+
/// Returns `true` if the float is a quiet or signaling NaN.
498498
fn is_nan(self) -> bool {
499499
self.category() == Category::NaN
500500
}
501501

502-
/// Returns true if and only if the float is a signaling NaN.
502+
/// Returns `true` if the float is a signaling NaN.
503503
fn is_signaling(self) -> bool;
504504

505505
// Simple Queries
@@ -518,19 +518,19 @@ pub trait Float
518518
self.is_zero() && self.is_negative()
519519
}
520520

521-
/// Returns true if and only if the number has the smallest possible non-zero
521+
/// Returns `true` if the number has the smallest possible non-zero
522522
/// magnitude in the current semantics.
523523
fn is_smallest(self) -> bool {
524524
Self::SMALLEST.copy_sign(self).bitwise_eq(self)
525525
}
526526

527-
/// Returns true if and only if the number has the largest possible finite
527+
/// Returns `true` if the number has the largest possible finite
528528
/// magnitude in the current semantics.
529529
fn is_largest(self) -> bool {
530530
Self::largest().copy_sign(self).bitwise_eq(self)
531531
}
532532

533-
/// Returns true if and only if the number is an exact integer.
533+
/// Returns `true` if the number is an exact integer.
534534
fn is_integer(self) -> bool {
535535
// This could be made more efficient; I'm going for obviously correct.
536536
if !self.is_finite() {
@@ -572,11 +572,11 @@ pub trait Float
572572
}
573573

574574
pub trait FloatConvert<T: Float>: Float {
575-
/// Convert a value of one floating point type to another.
575+
/// Converts a value of one floating point type to another.
576576
/// The return value corresponds to the IEEE754 exceptions. *loses_info
577577
/// records whether the transformation lost information, i.e., whether
578578
/// converting the result back to the original type will produce the
579-
/// original value (this is almost the same as return value==Status::OK,
579+
/// original value (this is almost the same as return `value == Status::OK`,
580580
/// but there are edge cases where this is not so).
581581
fn convert_r(self, round: Round, loses_info: &mut bool) -> StatusAnd<T>;
582582
fn convert(self, loses_info: &mut bool) -> StatusAnd<T> {

0 commit comments

Comments
 (0)