Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 009660d

Browse filesBrowse 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 54435f7 commit 009660d
Copy full SHA for 009660d

File tree

Expand file treeCollapse file tree

2 files changed

+3
-34
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-34
lines changed

‎std/src/f64.rs

Copy file name to clipboardExpand all lines: std/src/f64.rs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ impl f64 {
520520
#[stable(feature = "rust1", since = "1.0.0")]
521521
#[inline]
522522
pub fn ln(self) -> f64 {
523-
crate::sys::log_wrapper(self, |n| unsafe { intrinsics::logf64(n) })
523+
unsafe { intrinsics::logf64(self) }
524524
}
525525

526526
/// Returns the logarithm of the number with respect to an arbitrary base.
@@ -574,7 +574,7 @@ impl f64 {
574574
#[stable(feature = "rust1", since = "1.0.0")]
575575
#[inline]
576576
pub fn log2(self) -> f64 {
577-
crate::sys::log_wrapper(self, crate::sys::log2f64)
577+
crate::sys::log2f64(self)
578578
}
579579

580580
/// Returns the base 10 logarithm of the number.
@@ -599,7 +599,7 @@ impl f64 {
599599
#[stable(feature = "rust1", since = "1.0.0")]
600600
#[inline]
601601
pub fn log10(self) -> f64 {
602-
crate::sys::log_wrapper(self, |n| unsafe { intrinsics::log10f64(n) })
602+
unsafe { intrinsics::log10f64(self) }
603603
}
604604

605605
/// The positive difference of two numbers.

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

Copy file name to clipboardExpand all lines: std/src/sys/pal/mod.rs
-31Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -94,36 +94,5 @@ 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).
100-
#[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")))]
123-
#[inline]
124-
pub fn log_wrapper<F: Fn(f64) -> f64>(n: f64, log_fn: F) -> f64 {
125-
log_fn(n)
126-
}
127-
12897
#[cfg(not(target_os = "uefi"))]
12998
pub type RawOsError = i32;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.