1
Fork 0

Rollup merge of #137167 - martn3:reliable_f16_math-f16-erfc, r=tgross35

tests: Also gate `f16::erfc()` doctest with `reliable_f16_math` cfg

In #136324 the doctest for `f16::erf()` was gated with `reliable_f16_math`. Add the same gate on `f16::erfc()` to avoid:

    rust_out.71e2e529d20ea47d-cgu.0:\
    (.text._ZN8rust_out4main43_doctest_main_library_std_src_f16_rs_1321_017h485f3ffe6bf2a981E+0x38): \
    undefined reference to `__gnu_h2f_ieee'

on MIPS (and maybe other architectures).

r? tgross35
This commit is contained in:
Urgau 2025-02-18 18:34:15 +01:00 committed by GitHub
commit 14fb84a5bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1321,12 +1321,14 @@ impl f16 {
/// ``` /// ```
/// #![feature(f16)] /// #![feature(f16)]
/// #![feature(float_erf)] /// #![feature(float_erf)]
/// # #[cfg(reliable_f16_math)] {
/// let x: f16 = 0.123; /// let x: f16 = 0.123;
/// ///
/// let one = x.erf() + x.erfc(); /// let one = x.erf() + x.erfc();
/// let abs_difference = (one - 1.0).abs(); /// let abs_difference = (one - 1.0).abs();
/// ///
/// assert!(abs_difference <= f16::EPSILON); /// assert!(abs_difference <= f16::EPSILON);
/// # }
/// ``` /// ```
#[rustc_allow_incoherent_impl] #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"] #[must_use = "method returns a new number and does not mutate the original value"]