Skip to content

Commit a06411d

Browse files
committed
Update f16 doctests
1 parent 9dd7bb8 commit a06411d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library/std/src/f16.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1036,13 +1036,13 @@ impl f16 {
10361036
/// # #[cfg(not(bootstrap))]
10371037
/// # #[cfg(reliable_f16_math)] {
10381038
///
1039-
/// let x = 1e-8_f16;
1039+
/// let x = 1e-4_f16;
10401040
///
10411041
/// // for very small x, e^x is approximately 1 + x + x^2 / 2
10421042
/// let approx = x + x * x / 2.0;
10431043
/// let abs_difference = (x.exp_m1() - approx).abs();
10441044
///
1045-
/// assert!(abs_difference < 1e-10);
1045+
/// assert!(abs_difference < 1e-4);
10461046
/// # }
10471047
/// ```
10481048
#[inline]
@@ -1070,13 +1070,13 @@ impl f16 {
10701070
/// # #[cfg(not(bootstrap))]
10711071
/// # #[cfg(reliable_f16_math)] {
10721072
///
1073-
/// let x = 1e-8_f16;
1073+
/// let x = 1e-4_f16;
10741074
///
10751075
/// // for very small x, ln(1 + x) is approximately x - x^2 / 2
10761076
/// let approx = x - x * x / 2.0;
10771077
/// let abs_difference = (x.ln_1p() - approx).abs();
10781078
///
1079-
/// assert!(abs_difference < 1e-10);
1079+
/// assert!(abs_difference < 1e-4);
10801080
/// # }
10811081
/// ```
10821082
#[inline]
@@ -1282,7 +1282,7 @@ impl f16 {
12821282
///
12831283
/// let abs_difference = (f - e).abs();
12841284
///
1285-
/// assert!(abs_difference <= 1e-5);
1285+
/// assert!(abs_difference <= 0.01);
12861286
/// # }
12871287
/// ```
12881288
#[inline]

0 commit comments

Comments
 (0)