Skip to content

Commit 8d52b4d

Browse files
authored
Rollup merge of rust-lang#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>
2 parents 2b13128 + c353dbd commit 8d52b4d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

library/std/src/f32.rs

+9
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impl f32 {
6161
/// assert_eq!(f.ceil(), 4.0);
6262
/// assert_eq!(g.ceil(), 4.0);
6363
/// ```
64+
#[doc(alias = "ceiling")]
6465
#[rustc_allow_incoherent_impl]
6566
#[must_use = "method returns a new number and does not mutate the original value"]
6667
#[stable(feature = "rust1", since = "1.0.0")]
@@ -135,6 +136,7 @@ impl f32 {
135136
/// assert_eq!(g.trunc(), 3.0);
136137
/// assert_eq!(h.trunc(), -3.0);
137138
/// ```
139+
#[doc(alias = "truncate")]
138140
#[rustc_allow_incoherent_impl]
139141
#[must_use = "method returns a new number and does not mutate the original value"]
140142
#[stable(feature = "rust1", since = "1.0.0")]
@@ -672,6 +674,7 @@ impl f32 {
672674
///
673675
/// assert!(abs_difference <= f32::EPSILON);
674676
/// ```
677+
#[doc(alias = "arcsin")]
675678
#[rustc_allow_incoherent_impl]
676679
#[must_use = "method returns a new number and does not mutate the original value"]
677680
#[stable(feature = "rust1", since = "1.0.0")]
@@ -694,6 +697,7 @@ impl f32 {
694697
///
695698
/// assert!(abs_difference <= f32::EPSILON);
696699
/// ```
700+
#[doc(alias = "arccos")]
697701
#[rustc_allow_incoherent_impl]
698702
#[must_use = "method returns a new number and does not mutate the original value"]
699703
#[stable(feature = "rust1", since = "1.0.0")]
@@ -715,6 +719,7 @@ impl f32 {
715719
///
716720
/// assert!(abs_difference <= f32::EPSILON);
717721
/// ```
722+
#[doc(alias = "arctan")]
718723
#[rustc_allow_incoherent_impl]
719724
#[must_use = "method returns a new number and does not mutate the original value"]
720725
#[stable(feature = "rust1", since = "1.0.0")]
@@ -772,6 +777,7 @@ impl f32 {
772777
/// assert!(abs_difference_0 <= f32::EPSILON);
773778
/// assert!(abs_difference_1 <= f32::EPSILON);
774779
/// ```
780+
#[doc(alias = "sincos")]
775781
#[rustc_allow_incoherent_impl]
776782
#[stable(feature = "rust1", since = "1.0.0")]
777783
#[inline]
@@ -904,6 +910,7 @@ impl f32 {
904910
///
905911
/// assert!(abs_difference <= f32::EPSILON);
906912
/// ```
913+
#[doc(alias = "arcsinh")]
907914
#[rustc_allow_incoherent_impl]
908915
#[must_use = "method returns a new number and does not mutate the original value"]
909916
#[stable(feature = "rust1", since = "1.0.0")]
@@ -926,6 +933,7 @@ impl f32 {
926933
///
927934
/// assert!(abs_difference <= f32::EPSILON);
928935
/// ```
936+
#[doc(alias = "arccosh")]
929937
#[rustc_allow_incoherent_impl]
930938
#[must_use = "method returns a new number and does not mutate the original value"]
931939
#[stable(feature = "rust1", since = "1.0.0")]
@@ -950,6 +958,7 @@ impl f32 {
950958
///
951959
/// assert!(abs_difference <= 1e-5);
952960
/// ```
961+
#[doc(alias = "arctanh")]
953962
#[rustc_allow_incoherent_impl]
954963
#[must_use = "method returns a new number and does not mutate the original value"]
955964
#[stable(feature = "rust1", since = "1.0.0")]

library/std/src/f64.rs

+9
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impl f64 {
6161
/// assert_eq!(f.ceil(), 4.0);
6262
/// assert_eq!(g.ceil(), 4.0);
6363
/// ```
64+
#[doc(alias = "ceiling")]
6465
#[rustc_allow_incoherent_impl]
6566
#[must_use = "method returns a new number and does not mutate the original value"]
6667
#[stable(feature = "rust1", since = "1.0.0")]
@@ -135,6 +136,7 @@ impl f64 {
135136
/// assert_eq!(g.trunc(), 3.0);
136137
/// assert_eq!(h.trunc(), -3.0);
137138
/// ```
139+
#[doc(alias = "truncate")]
138140
#[rustc_allow_incoherent_impl]
139141
#[must_use = "method returns a new number and does not mutate the original value"]
140142
#[stable(feature = "rust1", since = "1.0.0")]
@@ -672,6 +674,7 @@ impl f64 {
672674
///
673675
/// assert!(abs_difference < 1e-10);
674676
/// ```
677+
#[doc(alias = "arcsin")]
675678
#[rustc_allow_incoherent_impl]
676679
#[must_use = "method returns a new number and does not mutate the original value"]
677680
#[stable(feature = "rust1", since = "1.0.0")]
@@ -694,6 +697,7 @@ impl f64 {
694697
///
695698
/// assert!(abs_difference < 1e-10);
696699
/// ```
700+
#[doc(alias = "arccos")]
697701
#[rustc_allow_incoherent_impl]
698702
#[must_use = "method returns a new number and does not mutate the original value"]
699703
#[stable(feature = "rust1", since = "1.0.0")]
@@ -715,6 +719,7 @@ impl f64 {
715719
///
716720
/// assert!(abs_difference < 1e-10);
717721
/// ```
722+
#[doc(alias = "arctan")]
718723
#[rustc_allow_incoherent_impl]
719724
#[must_use = "method returns a new number and does not mutate the original value"]
720725
#[stable(feature = "rust1", since = "1.0.0")]
@@ -772,6 +777,7 @@ impl f64 {
772777
/// assert!(abs_difference_0 < 1e-10);
773778
/// assert!(abs_difference_1 < 1e-10);
774779
/// ```
780+
#[doc(alias = "sincos")]
775781
#[rustc_allow_incoherent_impl]
776782
#[stable(feature = "rust1", since = "1.0.0")]
777783
#[inline]
@@ -904,6 +910,7 @@ impl f64 {
904910
///
905911
/// assert!(abs_difference < 1.0e-10);
906912
/// ```
913+
#[doc(alias = "arcsinh")]
907914
#[rustc_allow_incoherent_impl]
908915
#[must_use = "method returns a new number and does not mutate the original value"]
909916
#[stable(feature = "rust1", since = "1.0.0")]
@@ -926,6 +933,7 @@ impl f64 {
926933
///
927934
/// assert!(abs_difference < 1.0e-10);
928935
/// ```
936+
#[doc(alias = "arccosh")]
929937
#[rustc_allow_incoherent_impl]
930938
#[must_use = "method returns a new number and does not mutate the original value"]
931939
#[stable(feature = "rust1", since = "1.0.0")]
@@ -950,6 +958,7 @@ impl f64 {
950958
///
951959
/// assert!(abs_difference < 1.0e-10);
952960
/// ```
961+
#[doc(alias = "arctanh")]
953962
#[rustc_allow_incoherent_impl]
954963
#[must_use = "method returns a new number and does not mutate the original value"]
955964
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)