@@ -600,7 +600,7 @@ impl f32 {
600600 /// ```
601601 /// use std::f32;
602602 ///
603- /// let x = f32::consts::PI/2.0 ;
603+ /// let x = f32::consts::FRAC_PI_2 ;
604604 ///
605605 /// let abs_difference = (x.sin() - 1.0).abs();
606606 ///
@@ -646,7 +646,7 @@ impl f32 {
646646 /// ```
647647 /// use std::f32;
648648 ///
649- /// let x = f32::consts::PI / 4.0 ;
649+ /// let x = f32::consts::FRAC_PI_4 ;
650650 /// let abs_difference = (x.tan() - 1.0).abs();
651651 ///
652652 /// assert!(abs_difference <= f32::EPSILON);
@@ -666,10 +666,10 @@ impl f32 {
666666 /// ```
667667 /// use std::f32;
668668 ///
669- /// let f = f32::consts::PI / 2.0 ;
669+ /// let f = f32::consts::FRAC_PI_2 ;
670670 ///
671671 /// // asin(sin(pi/2))
672- /// let abs_difference = (f.sin().asin() - f32::consts::PI / 2.0 ).abs();
672+ /// let abs_difference = (f.sin().asin() - f32::consts::FRAC_PI_2 ).abs();
673673 ///
674674 /// assert!(abs_difference <= f32::EPSILON);
675675 /// ```
@@ -688,10 +688,10 @@ impl f32 {
688688 /// ```
689689 /// use std::f32;
690690 ///
691- /// let f = f32::consts::PI / 4.0 ;
691+ /// let f = f32::consts::FRAC_PI_4 ;
692692 ///
693693 /// // acos(cos(pi/4))
694- /// let abs_difference = (f.cos().acos() - f32::consts::PI / 4.0 ).abs();
694+ /// let abs_difference = (f.cos().acos() - f32::consts::FRAC_PI_4 ).abs();
695695 ///
696696 /// assert!(abs_difference <= f32::EPSILON);
697697 /// ```
@@ -734,7 +734,6 @@ impl f32 {
734734 /// ```
735735 /// use std::f32;
736736 ///
737- /// let pi = f32::consts::PI;
738737 /// // Positive angles measured counter-clockwise
739738 /// // from positive x axis
740739 /// // -pi/4 radians (45 deg clockwise)
@@ -745,8 +744,8 @@ impl f32 {
745744 /// let x2 = -3.0f32;
746745 /// let y2 = 3.0f32;
747746 ///
748- /// let abs_difference_1 = (y1.atan2(x1) - (-pi / 4.0 )).abs();
749- /// let abs_difference_2 = (y2.atan2(x2) - (3.0 * pi / 4.0 )).abs();
747+ /// let abs_difference_1 = (y1.atan2(x1) - (-f32::consts::FRAC_PI_4 )).abs();
748+ /// let abs_difference_2 = (y2.atan2(x2) - (3.0 * f32::consts::FRAC_PI_4 )).abs();
750749 ///
751750 /// assert!(abs_difference_1 <= f32::EPSILON);
752751 /// assert!(abs_difference_2 <= f32::EPSILON);
@@ -765,7 +764,7 @@ impl f32 {
765764 /// ```
766765 /// use std::f32;
767766 ///
768- /// let x = f32::consts::PI/4.0 ;
767+ /// let x = f32::consts::FRAC_PI_4 ;
769768 /// let f = x.sin_cos();
770769 ///
771770 /// let abs_difference_0 = (f.0 - x.sin()).abs();
0 commit comments