@@ -443,6 +443,12 @@ impl f32 {
443443 ///
444444 /// assert!(abs_difference <= f32::EPSILON);
445445 /// ```
446+ ///
447+ /// Non-positive values:
448+ /// ```
449+ /// assert_eq!(0_f32.ln(), f32::NEG_INFINITY);
450+ /// assert!((-42_f32).ln().is_nan());
451+ /// ```
446452 #[ rustc_allow_incoherent_impl]
447453 #[ must_use = "method returns a new number and does not mutate the original value" ]
448454 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -474,6 +480,12 @@ impl f32 {
474480 ///
475481 /// assert!(abs_difference <= f32::EPSILON);
476482 /// ```
483+ ///
484+ /// Non-positive values:
485+ /// ```
486+ /// assert_eq!(0_f32.log(10.0), f32::NEG_INFINITY);
487+ /// assert!((-42_f32).log(10.0).is_nan());
488+ /// ```
477489 #[ rustc_allow_incoherent_impl]
478490 #[ must_use = "method returns a new number and does not mutate the original value" ]
479491 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -501,6 +513,12 @@ impl f32 {
501513 ///
502514 /// assert!(abs_difference <= f32::EPSILON);
503515 /// ```
516+ ///
517+ /// Non-positive values:
518+ /// ```
519+ /// assert_eq!(0_f32.log2(), f32::NEG_INFINITY);
520+ /// assert!((-42_f32).log2().is_nan());
521+ /// ```
504522 #[ rustc_allow_incoherent_impl]
505523 #[ must_use = "method returns a new number and does not mutate the original value" ]
506524 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -528,6 +546,12 @@ impl f32 {
528546 ///
529547 /// assert!(abs_difference <= f32::EPSILON);
530548 /// ```
549+ ///
550+ /// Non-positive values:
551+ /// ```
552+ /// assert_eq!(0_f32.log10(), f32::NEG_INFINITY);
553+ /// assert!((-42_f32).log10().is_nan());
554+ /// ```
531555 #[ rustc_allow_incoherent_impl]
532556 #[ must_use = "method returns a new number and does not mutate the original value" ]
533557 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -901,6 +925,8 @@ impl f32 {
901925 /// Returns `ln(1+n)` (natural logarithm) more accurately than if
902926 /// the operations were performed separately.
903927 ///
928+ /// This returns NaN when `n < -1.0`, and negative infinity when `n == -1.0`.
929+ ///
904930 /// # Unspecified precision
905931 ///
906932 /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
@@ -919,6 +945,12 @@ impl f32 {
919945 ///
920946 /// assert!(abs_difference < 1e-10);
921947 /// ```
948+ ///
949+ /// Out-of-range values:
950+ /// ```
951+ /// assert_eq!((-1.0_f32).ln_1p(), f32::NEG_INFINITY);
952+ /// assert!((-2.0_f32).ln_1p().is_nan());
953+ /// ```
922954 #[ doc( alias = "log1p" ) ]
923955 #[ rustc_allow_incoherent_impl]
924956 #[ must_use = "method returns a new number and does not mutate the original value" ]
0 commit comments