Skip to content

Commit

Permalink
variable-precision float operations behave non-deterministically
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 2, 2024
1 parent fcc06c8 commit 7de46e5
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 58 deletions.
87 changes: 58 additions & 29 deletions library/std/src/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -395,7 +396,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand Down Expand Up @@ -446,7 +448,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -472,7 +475,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -496,7 +500,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand Down Expand Up @@ -526,7 +531,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -550,7 +556,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -574,7 +581,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -601,7 +609,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `fdimf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -639,7 +648,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `cbrtf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -668,7 +678,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `hypotf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand All @@ -695,7 +706,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -718,7 +730,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -741,7 +754,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `tanf` from libc on Unix and
/// Windows. Note that this might change in the future.
///
Expand All @@ -767,7 +781,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `asinf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -796,7 +811,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `acosf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -824,7 +840,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `atanf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -856,7 +873,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `atan2f` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -892,7 +910,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `(f32::sin(x),
/// f32::cos(x))`. Note that this might change in the future.
///
Expand Down Expand Up @@ -921,7 +940,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `expm1f` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -949,7 +969,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `log1pf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -977,7 +998,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `sinhf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -1006,7 +1028,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `coshf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -1035,7 +1058,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `tanhf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -1064,7 +1088,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -1091,7 +1116,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand Down Expand Up @@ -1120,7 +1146,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
///
/// # Examples
///
Expand All @@ -1145,7 +1172,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `tgammaf` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down Expand Up @@ -1173,7 +1201,8 @@ impl f32 {
///
/// # Platform-specific precision
///
/// The precision of this function varies by platform and Rust version.
/// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
/// even can even differ within the same execution from one invocation to the next.
/// This function currently corresponds to the `lgamma_r` from libc on Unix
/// and Windows. Note that this might change in the future.
///
Expand Down
Loading

0 comments on commit 7de46e5

Please sign in to comment.