Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit be692e3

Browse files
committedFeb 21, 2025
Document results of non-positive logarithms
1 parent f04bbc6 commit be692e3

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
 

‎library/std/src/f128.rs

+8
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ impl f128 {
468468

469469
/// Returns the natural logarithm of the number.
470470
///
471+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
472+
///
471473
/// # Unspecified precision
472474
///
473475
/// The precision of this function is non-deterministic. This means it varies by platform,
@@ -499,6 +501,8 @@ impl f128 {
499501

500502
/// Returns the logarithm of the number with respect to an arbitrary base.
501503
///
504+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
505+
///
502506
/// The result might not be correctly rounded owing to implementation details;
503507
/// `self.log2()` can produce more accurate results for base 2, and
504508
/// `self.log10()` can produce more accurate results for base 10.
@@ -532,6 +536,8 @@ impl f128 {
532536

533537
/// Returns the base 2 logarithm of the number.
534538
///
539+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
540+
///
535541
/// # Unspecified precision
536542
///
537543
/// The precision of this function is non-deterministic. This means it varies by platform,
@@ -561,6 +567,8 @@ impl f128 {
561567

562568
/// Returns the base 10 logarithm of the number.
563569
///
570+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
571+
///
564572
/// # Unspecified precision
565573
///
566574
/// The precision of this function is non-deterministic. This means it varies by platform,

‎library/std/src/f16.rs

+8
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ impl f16 {
468468

469469
/// Returns the natural logarithm of the number.
470470
///
471+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
472+
///
471473
/// # Unspecified precision
472474
///
473475
/// The precision of this function is non-deterministic. This means it varies by platform,
@@ -499,6 +501,8 @@ impl f16 {
499501

500502
/// Returns the logarithm of the number with respect to an arbitrary base.
501503
///
504+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
505+
///
502506
/// The result might not be correctly rounded owing to implementation details;
503507
/// `self.log2()` can produce more accurate results for base 2, and
504508
/// `self.log10()` can produce more accurate results for base 10.
@@ -532,6 +536,8 @@ impl f16 {
532536

533537
/// Returns the base 2 logarithm of the number.
534538
///
539+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
540+
///
535541
/// # Unspecified precision
536542
///
537543
/// The precision of this function is non-deterministic. This means it varies by platform,
@@ -560,6 +566,8 @@ impl f16 {
560566
}
561567

562568
/// Returns the base 10 logarithm of the number.
569+
///
570+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
563571
///
564572
/// # Unspecified precision
565573
///

‎library/std/src/f32.rs

+8
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ impl f32 {
424424

425425
/// Returns the natural logarithm of the number.
426426
///
427+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
428+
///
427429
/// # Unspecified precision
428430
///
429431
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
@@ -451,6 +453,8 @@ impl f32 {
451453

452454
/// Returns the logarithm of the number with respect to an arbitrary base.
453455
///
456+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
457+
///
454458
/// The result might not be correctly rounded owing to implementation details;
455459
/// `self.log2()` can produce more accurate results for base 2, and
456460
/// `self.log10()` can produce more accurate results for base 10.
@@ -480,6 +484,8 @@ impl f32 {
480484

481485
/// Returns the base 2 logarithm of the number.
482486
///
487+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
488+
///
483489
/// # Unspecified precision
484490
///
485491
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
@@ -505,6 +511,8 @@ impl f32 {
505511

506512
/// Returns the base 10 logarithm of the number.
507513
///
514+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
515+
///
508516
/// # Unspecified precision
509517
///
510518
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and

‎library/std/src/f64.rs

+8
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ impl f64 {
424424

425425
/// Returns the natural logarithm of the number.
426426
///
427+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
428+
///
427429
/// # Unspecified precision
428430
///
429431
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
@@ -451,6 +453,8 @@ impl f64 {
451453

452454
/// Returns the logarithm of the number with respect to an arbitrary base.
453455
///
456+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
457+
///
454458
/// The result might not be correctly rounded owing to implementation details;
455459
/// `self.log2()` can produce more accurate results for base 2, and
456460
/// `self.log10()` can produce more accurate results for base 10.
@@ -480,6 +484,8 @@ impl f64 {
480484

481485
/// Returns the base 2 logarithm of the number.
482486
///
487+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
488+
///
483489
/// # Unspecified precision
484490
///
485491
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
@@ -505,6 +511,8 @@ impl f64 {
505511

506512
/// Returns the base 10 logarithm of the number.
507513
///
514+
/// This returns NaN when the number is negative, and negative infinity when number is zero.
515+
///
508516
/// # Unspecified precision
509517
///
510518
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and

0 commit comments

Comments
 (0)
Failed to load comments.