Skip to content

Commit e90406f

Browse files
committed
std: removes logarithms family function edge cases handling for solaris.
Issue had been fixed over time with solaris, 11.x behaves correctly (and we support it as minimum), illumos works correctly too.
1 parent a241cf1 commit e90406f

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

library/std/src/sys/pal/mod.rs

-25
Original file line numberDiff line numberDiff line change
@@ -94,32 +94,7 @@ cfg_if::cfg_if! {
9494
}
9595
}
9696

97-
// Solaris/Illumos requires a wrapper around log, log2, and log10 functions
98-
// because of their non-standard behavior (e.g., log(-n) returns -Inf instead
99-
// of expected NaN).
10097
#[cfg(not(test))]
101-
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
102-
#[inline]
103-
pub fn log_wrapper<F: Fn(f64) -> f64>(n: f64, log_fn: F) -> f64 {
104-
if n.is_finite() {
105-
if n > 0.0 {
106-
log_fn(n)
107-
} else if n == 0.0 {
108-
f64::NEG_INFINITY // log(0) = -Inf
109-
} else {
110-
f64::NAN // log(-n) = NaN
111-
}
112-
} else if n.is_nan() {
113-
n // log(NaN) = NaN
114-
} else if n > 0.0 {
115-
n // log(Inf) = Inf
116-
} else {
117-
f64::NAN // log(-Inf) = NaN
118-
}
119-
}
120-
121-
#[cfg(not(test))]
122-
#[cfg(not(any(target_os = "solaris", target_os = "illumos")))]
12398
#[inline]
12499
pub fn log_wrapper<F: Fn(f64) -> f64>(n: f64, log_fn: F) -> f64 {
125100
log_fn(n)

0 commit comments

Comments
 (0)