Rollup merge of #114971 - kpreid:trig, r=joshtriplett

Add doc aliases for trigonometry and other f32,f64 methods.

These are common alternate names, usually a less-abbreviated form, for the operation; e.g. `arctan` instead of `atan`. Prompted by <https://users.rust-lang.org/t/64-bit-trigonometry/98599>
This commit is contained in:
Matthias Krüger 2023-08-19 03:27:00 +02:00 committed by GitHub
commit 8d52b4d2f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -61,6 +61,7 @@ impl f32 {
/// assert_eq!(f.ceil(), 4.0);
/// assert_eq!(g.ceil(), 4.0);
/// ```
#[doc(alias = "ceiling")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -135,6 +136,7 @@ impl f32 {
/// assert_eq!(g.trunc(), 3.0);
/// assert_eq!(h.trunc(), -3.0);
/// ```
#[doc(alias = "truncate")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -672,6 +674,7 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[doc(alias = "arcsin")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -694,6 +697,7 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[doc(alias = "arccos")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -715,6 +719,7 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[doc(alias = "arctan")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -772,6 +777,7 @@ impl f32 {
/// assert!(abs_difference_0 <= f32::EPSILON);
/// assert!(abs_difference_1 <= f32::EPSILON);
/// ```
#[doc(alias = "sincos")]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
@ -904,6 +910,7 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[doc(alias = "arcsinh")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -926,6 +933,7 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[doc(alias = "arccosh")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -950,6 +958,7 @@ impl f32 {
///
/// assert!(abs_difference <= 1e-5);
/// ```
#[doc(alias = "arctanh")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -61,6 +61,7 @@ impl f64 {
/// assert_eq!(f.ceil(), 4.0);
/// assert_eq!(g.ceil(), 4.0);
/// ```
#[doc(alias = "ceiling")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -135,6 +136,7 @@ impl f64 {
/// assert_eq!(g.trunc(), 3.0);
/// assert_eq!(h.trunc(), -3.0);
/// ```
#[doc(alias = "truncate")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -672,6 +674,7 @@ impl f64 {
///
/// assert!(abs_difference < 1e-10);
/// ```
#[doc(alias = "arcsin")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -694,6 +697,7 @@ impl f64 {
///
/// assert!(abs_difference < 1e-10);
/// ```
#[doc(alias = "arccos")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -715,6 +719,7 @@ impl f64 {
///
/// assert!(abs_difference < 1e-10);
/// ```
#[doc(alias = "arctan")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -772,6 +777,7 @@ impl f64 {
/// assert!(abs_difference_0 < 1e-10);
/// assert!(abs_difference_1 < 1e-10);
/// ```
#[doc(alias = "sincos")]
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
@ -904,6 +910,7 @@ impl f64 {
///
/// assert!(abs_difference < 1.0e-10);
/// ```
#[doc(alias = "arcsinh")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -926,6 +933,7 @@ impl f64 {
///
/// assert!(abs_difference < 1.0e-10);
/// ```
#[doc(alias = "arccosh")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
@ -950,6 +958,7 @@ impl f64 {
///
/// assert!(abs_difference < 1.0e-10);
/// ```
#[doc(alias = "arctanh")]
#[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]