@@ -1508,9 +1508,7 @@ impl f32 {
1508
1508
}
1509
1509
}
1510
1510
1511
- /// Returns the largest integer less than or equal to `self`.
1512
- ///
1513
- /// This function always returns the precise result.
1511
+ /// Experimental version of `floor` in `core`. See [`f32::floor`] for details.
1514
1512
///
1515
1513
/// # Examples
1516
1514
///
@@ -1537,9 +1535,7 @@ pub fn floor(x: f32) -> f32 {
1537
1535
unsafe { intrinsics:: floorf32 ( x) }
1538
1536
}
1539
1537
1540
- /// Returns the smallest integer greater than or equal to `self`.
1541
- ///
1542
- /// This function always returns the precise result.
1538
+ /// Experimental version of `ceil` in `core`. See [`f32::ceil`] for details.
1543
1539
///
1544
1540
/// # Examples
1545
1541
///
@@ -1565,10 +1561,7 @@ pub fn ceil(x: f32) -> f32 {
1565
1561
unsafe { intrinsics:: ceilf32 ( x) }
1566
1562
}
1567
1563
1568
- /// Returns the nearest integer to `self`. If a value is half-way between two
1569
- /// integers, round away from `0.0`.
1570
- ///
1571
- /// This function always returns the precise result.
1564
+ /// Experimental version of `round` in `core`. See [`f32::round`] for details.
1572
1565
///
1573
1566
/// # Examples
1574
1567
///
@@ -1599,10 +1592,7 @@ pub fn round(x: f32) -> f32 {
1599
1592
unsafe { intrinsics:: roundf32 ( x) }
1600
1593
}
1601
1594
1602
- /// Returns the nearest integer to a number. Rounds half-way cases to the number
1603
- /// with an even least significant digit.
1604
- ///
1605
- /// This function always returns the precise result.
1595
+ /// Experimental version of `round_ties_even` in `core`. See [`f32::round_ties_even`] for details.
1606
1596
///
1607
1597
/// # Examples
1608
1598
///
@@ -1630,10 +1620,7 @@ pub fn round_ties_even(x: f32) -> f32 {
1630
1620
intrinsics:: round_ties_even_f32 ( x)
1631
1621
}
1632
1622
1633
- /// Returns the integer part of `self`.
1634
- /// This means that non-integer numbers are always truncated towards zero.
1635
- ///
1636
- /// This function always returns the precise result.
1623
+ /// Experimental version of `trunc` in `core`. See [`f32::trunc`] for details.
1637
1624
///
1638
1625
/// # Examples
1639
1626
///
@@ -1661,9 +1648,7 @@ pub fn trunc(x: f32) -> f32 {
1661
1648
unsafe { intrinsics:: truncf32 ( x) }
1662
1649
}
1663
1650
1664
- /// Returns the fractional part of `self`.
1665
- ///
1666
- /// This function always returns the precise result.
1651
+ /// Experimental version of `fract` in `core`. See [`f32::fract`] for details.
1667
1652
///
1668
1653
/// # Examples
1669
1654
///
@@ -1689,19 +1674,7 @@ pub fn fract(x: f32) -> f32 {
1689
1674
x - trunc ( x)
1690
1675
}
1691
1676
1692
- /// Fused multiply-add. Computes `(self * a) + b` with only one rounding
1693
- /// error, yielding a more accurate result than an unfused multiply-add.
1694
- ///
1695
- /// Using `mul_add` *may* be more performant than an unfused multiply-add if
1696
- /// the target architecture has a dedicated `fma` CPU instruction. However,
1697
- /// this is not always true, and will be heavily dependant on designing
1698
- /// algorithms with specific target hardware in mind.
1699
- ///
1700
- /// # Precision
1701
- ///
1702
- /// The result of this operation is guaranteed to be the rounded
1703
- /// infinite-precision result. It is specified by IEEE 754 as
1704
- /// `fusedMultiplyAdd` and guaranteed not to change.
1677
+ /// Experimental version of `mul_add` in `core`. See [`f32::mul_add`] for details.
1705
1678
///
1706
1679
/// # Examples
1707
1680
///
@@ -1737,17 +1710,7 @@ pub fn mul_add(x: f32, y: f32, z: f32) -> f32 {
1737
1710
unsafe { intrinsics:: fmaf32 ( x, y, z) }
1738
1711
}
1739
1712
1740
- /// Calculates Euclidean division, the matching method for `rem_euclid`.
1741
- ///
1742
- /// This computes the integer `n` such that
1743
- /// `self = n * rhs + self.rem_euclid(rhs)`.
1744
- /// In other words, the result is `self / rhs` rounded to the integer `n`
1745
- /// such that `self >= n * rhs`.
1746
- ///
1747
- /// # Precision
1748
- ///
1749
- /// The result of this operation is guaranteed to be the rounded
1750
- /// infinite-precision result.
1713
+ /// Experimental version of `div_euclid` in `core`. See [`f32::div_euclid`] for details.
1751
1714
///
1752
1715
/// # Examples
1753
1716
///
@@ -1776,21 +1739,7 @@ pub fn div_euclid(x: f32, rhs: f32) -> f32 {
1776
1739
q
1777
1740
}
1778
1741
1779
- /// Calculates the least nonnegative remainder of `self (mod rhs)`.
1780
- ///
1781
- /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in
1782
- /// most cases. However, due to a floating point round-off error it can
1783
- /// result in `r == rhs.abs()`, violating the mathematical definition, if
1784
- /// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`.
1785
- /// This result is not an element of the function's codomain, but it is the
1786
- /// closest floating point number in the real numbers and thus fulfills the
1787
- /// property `self == self.div_euclid(rhs) * rhs + self.rem_euclid(rhs)`
1788
- /// approximately.
1789
- ///
1790
- /// # Precision
1791
- ///
1792
- /// The result of this operation is guaranteed to be the rounded
1793
- /// infinite-precision result.
1742
+ /// Experimental version of `rem_euclid` in `core`. See [`f32::rem_euclid`] for details.
1794
1743
///
1795
1744
/// # Examples
1796
1745
///
@@ -1819,16 +1768,7 @@ pub fn rem_euclid(x: f32, rhs: f32) -> f32 {
1819
1768
if r < 0.0 { r + rhs. abs ( ) } else { r }
1820
1769
}
1821
1770
1822
- /// Raises a number to an integer power.
1823
- ///
1824
- /// Using this function is generally faster than using `powf`.
1825
- /// It might have a different sequence of rounding operations than `powf`,
1826
- /// so the results are not guaranteed to agree.
1827
- ///
1828
- /// # Unspecified precision
1829
- ///
1830
- /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
1831
- /// can even differ within the same execution from one invocation to the next.
1771
+ /// Experimental version of `powi` in `core`. See [`f32::powi`] for details.
1832
1772
///
1833
1773
/// # Examples
1834
1774
///
@@ -1853,15 +1793,7 @@ pub fn powi(x: f32, n: i32) -> f32 {
1853
1793
unsafe { intrinsics:: powif32 ( x, n) }
1854
1794
}
1855
1795
1856
- /// Returns the square root of a number.
1857
- ///
1858
- /// Returns NaN if `self` is a negative number other than `-0.0`.
1859
- ///
1860
- /// # Precision
1861
- ///
1862
- /// The result of this operation is guaranteed to be the rounded
1863
- /// infinite-precision result. It is specified by IEEE 754 as `squareRoot`
1864
- /// and guaranteed not to change.
1796
+ /// Experimental version of `sqrt` in `core`. See [`f32::sqrt`] for details.
1865
1797
///
1866
1798
/// # Examples
1867
1799
///
@@ -1889,17 +1821,7 @@ pub fn sqrt(x: f32) -> f32 {
1889
1821
unsafe { intrinsics:: sqrtf32 ( x) }
1890
1822
}
1891
1823
1892
- /// The positive difference of two numbers.
1893
- ///
1894
- /// * If `self <= other`: `0.0`
1895
- /// * Else: `self - other`
1896
- ///
1897
- /// # Unspecified precision
1898
- ///
1899
- /// The precision of this function is non-deterministic. This means it varies by platform, Rust version, and
1900
- /// can even differ within the same execution from one invocation to the next.
1901
- /// This function currently corresponds to the `fdimf` from libc on Unix
1902
- /// and Windows. Note that this might change in the future.
1824
+ /// Experimental version of `abs_sub` in `core`. See [`f32::abs_sub`] for details.
1903
1825
///
1904
1826
/// # Examples
1905
1827
///
@@ -1937,7 +1859,7 @@ pub fn abs_sub(x: f32, other: f32) -> f32 {
1937
1859
unsafe { libm:: fdimf ( x, other) }
1938
1860
}
1939
1861
1940
- /// Returns the cube root of a number .
1862
+ /// Experimental version of `cbrt` in `core`. See [`f32::cbrt`] for details .
1941
1863
///
1942
1864
/// # Unspecified precision
1943
1865
///
@@ -1956,6 +1878,8 @@ pub fn abs_sub(x: f32, other: f32) -> f32 {
1956
1878
///
1957
1879
/// assert!(abs_difference <= f32::EPSILON);
1958
1880
/// ```
1881
+ ///
1882
+ /// _This standalone function is for testing only. It will be stabilized as an inherent method._
1959
1883
#[ inline]
1960
1884
#[ must_use = "method returns a new number and does not mutate the original value" ]
1961
1885
#[ unstable( feature = "core_float_math" , issue = "137578" ) ]
0 commit comments