Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit9fc6710

Browse files
committed
Auto merge ofrust-lang#127719 - devnexen:math_log_fix_solill, r=Amanieu
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.
2 parentsd7aa7cf +009660d commit9fc6710

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

‎std/src/f64.rs‎

Lines 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
pubfnln(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
pubfnlog2(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
pubfnlog10(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‎

Lines 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-
pubfnlog_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-
}elseif n ==0.0{
108-
f64::NEG_INFINITY// log(0) = -Inf
109-
}else{
110-
f64::NAN// log(-n) = NaN
111-
}
112-
}elseif n.is_nan(){
113-
n// log(NaN) = NaN
114-
}elseif 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-
pubfnlog_wrapper<F:Fn(f64) ->f64>(n:f64,log_fn:F) ->f64{
125-
log_fn(n)
126-
}
127-
12897
#[cfg(not(target_os ="uefi"))]
12998
pubtypeRawOsError =i32;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp