@@ -426,7 +426,7 @@ impl f64 {
426426 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
427427 #[ inline]
428428 pub fn ln ( self ) -> f64 {
429- self . log_wrapper ( |n| unsafe { intrinsics:: logf64 ( n) } )
429+ crate :: sys :: log_wrapper ( self , |n| unsafe { intrinsics:: logf64 ( n) } )
430430 }
431431
432432 /// Returns the logarithm of the number with respect to an arbitrary base.
@@ -470,7 +470,7 @@ impl f64 {
470470 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
471471 #[ inline]
472472 pub fn log2 ( self ) -> f64 {
473- self . log_wrapper ( crate :: sys:: log2f64)
473+ crate :: sys :: log_wrapper ( self , crate :: sys:: log2f64)
474474 }
475475
476476 /// Returns the base 10 logarithm of the number.
@@ -490,7 +490,7 @@ impl f64 {
490490 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
491491 #[ inline]
492492 pub fn log10 ( self ) -> f64 {
493- self . log_wrapper ( |n| unsafe { intrinsics:: log10f64 ( n) } )
493+ crate :: sys :: log_wrapper ( self , |n| unsafe { intrinsics:: log10f64 ( n) } )
494494 }
495495
496496 /// The positive difference of two numbers.
@@ -925,28 +925,4 @@ impl f64 {
925925 pub fn atanh ( self ) -> f64 {
926926 0.5 * ( ( 2.0 * self ) / ( 1.0 - self ) ) . ln_1p ( )
927927 }
928-
929- // Solaris/Illumos requires a wrapper around log, log2, and log10 functions
930- // because of their non-standard behavior (e.g., log(-n) returns -Inf instead
931- // of expected NaN).
932- #[ rustc_allow_incoherent_impl]
933- fn log_wrapper < F : Fn ( f64 ) -> f64 > ( self , log_fn : F ) -> f64 {
934- if let Some ( result) = crate :: sys:: log_wrapper ( self ) {
935- log_fn ( result)
936- } else if self . is_finite ( ) {
937- if self > 0.0 {
938- log_fn ( self )
939- } else if self == 0.0 {
940- Self :: NEG_INFINITY // log(0) = -Inf
941- } else {
942- Self :: NAN // log(-n) = NaN
943- }
944- } else if self . is_nan ( ) {
945- self // log(NaN) = NaN
946- } else if self > 0.0 {
947- self // log(Inf) = Inf
948- } else {
949- Self :: NAN // log(-Inf) = NaN
950- }
951- }
952928}
0 commit comments