about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/std_example.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-10 06:36:10 +0000
committerbors <bors@rust-lang.org>2024-07-10 06:36:10 +0000
commitab7c910590a6fc1551adfea61fb5bf728c652086 (patch)
tree2e323a493934df698ffa8751d965f3cdbd6b837a /compiler/rustc_codegen_gcc/example/std_example.rs
parent279494eced419dca11c4b8e589fc6cec9dc82f46 (diff)
parente42a380afcd228fad0696d4cb919173b51083212 (diff)
downloadrust-ab7c910590a6fc1551adfea61fb5bf728c652086.tar.gz
rust-ab7c910590a6fc1551adfea61fb5bf728c652086.zip
Auto merge of #13079 - sandersaares:u/sasaares/no-epsilon-guidance, r=y21
Fix guidance of [`float_cmp`] and [`float_cmp_const`] to not incorrectly recommend `f__::EPSILON` as the error margin.

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 sample implementation for 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 equality comparison for cases where absolute error margins cannot be identified.

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

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