about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/alloc_example.rs
diff options
context:
space:
mode:
authorSander Saares <sander@saares.eu>2024-07-09 10:12:09 +0300
committerSander Saares <sander@saares.eu>2024-07-09 10:12:09 +0300
commita067cd24ace399be139578aeb0b3137785a79eb7 (patch)
tree47c170df58ef82ffe5a8548da982b66256b175ad /compiler/rustc_codegen_gcc/example/alloc_example.rs
parent1de41b18d2861d2baab01e45e44fe5612151d1a6 (diff)
downloadrust-a067cd24ace399be139578aeb0b3137785a79eb7.tar.gz
rust-a067cd24ace399be139578aeb0b3137785a79eb7.zip
Replace incorrect suggested fix for `float_cmp`
Using `f32::EPSILON` or `f64::EPSILON` as the floating-point equality comparison error margin is incorrect, yet `float_cmp` has until now recommended this be done. This change fixes the given guidance (both in docs and compiler hints) to not reference these unsuitable constants.

Instead, the guidance now clarifies that the scenarios in which an absolute error margin is usable, provides a reference implementation of using a user-defined absolute error margin (as an absolute error margin can only be used-defined and may be different for different comparisons) and references the floating point guide for a reference implementation of relative error based equaltiy comparison for when absolute error margin cannot be used.

changelog: Fix guidance of [`float_cmp`] and [`float_cmp_const`] to not incorrectly recommend `f64::EPSILON` as the error margin.

Fixes #6816
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/alloc_example.rs')
0 files changed, 0 insertions, 0 deletions