@@ -1269,4 +1269,61 @@ impl f128 {
12691269 let x = unsafe { cmath:: lgammaf128_r ( self , & mut signgamp) } ;
12701270 ( x, signgamp)
12711271 }
1272+
1273+ /// Error function.
1274+ ///
1275+ /// # Unspecified precision
1276+ ///
1277+ /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
1278+ /// can even differ within the same execution from one invocation to the next.
1279+ /// This function currently corresponds to the `erff128` from libc on Unix
1280+ /// and Windows. Note that this might change in the future.
1281+ ///
1282+ /// # Examples
1283+ ///
1284+ /// ```
1285+ /// #![feature(f128)]
1286+ /// #![feature(float_erf)]
1287+ /// let x: f128 = 1.0;
1288+ ///
1289+ /// let abs_difference = (x.erf() - 0.8427007929497148693412206350826093).abs();
1290+ ///
1291+ /// assert!(abs_difference <= f128::EPSILON);
1292+ /// ```
1293+ #[ rustc_allow_incoherent_impl]
1294+ #[ must_use = "method returns a new number and does not mutate the original value" ]
1295+ #[ unstable( feature = "float_erf" , issue = "136321" ) ]
1296+ #[ inline]
1297+ pub fn erf ( self ) -> f128 {
1298+ unsafe { cmath:: erff128 ( self ) }
1299+ }
1300+
1301+ /// Complementary error function.
1302+ ///
1303+ /// # Unspecified precision
1304+ ///
1305+ /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
1306+ /// can even differ within the same execution from one invocation to the next.
1307+ /// This function currently corresponds to the `erfcf128` from libc on Unix
1308+ /// and Windows. Note that this might change in the future.
1309+ ///
1310+ /// # Examples
1311+ ///
1312+ /// ```
1313+ /// #![feature(f128)]
1314+ /// #![feature(float_erf)]
1315+ /// let x: f128 = 0.123;
1316+ ///
1317+ /// let one = x.erf() + x.erfc();
1318+ /// let abs_difference = (one - 1.0).abs();
1319+ ///
1320+ /// assert!(abs_difference <= f128::EPSILON);
1321+ /// ```
1322+ #[ rustc_allow_incoherent_impl]
1323+ #[ must_use = "method returns a new number and does not mutate the original value" ]
1324+ #[ unstable( feature = "float_erf" , issue = "136321" ) ]
1325+ #[ inline]
1326+ pub fn erfc ( self ) -> f128 {
1327+ unsafe { cmath:: erfcf128 ( self ) }
1328+ }
12721329}
0 commit comments