Rollup merge of #125571 - tesuji:dummy-pi, r=Nilstrieb · model-checking/verify-rust-std@3e545bc (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -901,8 +901,8 @@ impl f32 { | ||
901 | 901 | #[stable(feature = "f32_deg_rad_conversions", since = "1.7.0")] |
902 | 902 | #[inline] |
903 | 903 | pub fn to_radians(self) -> f32 { |
904 | -let value: f32 = consts::PI; | |
905 | -self * (value / 180.0f32) | |
904 | +const RADS_PER_DEG: f32 = consts::PI / 180.0; | |
905 | +self * RADS_PER_DEG | |
906 | 906 | } |
907 | 907 | |
908 | 908 | /// Returns the maximum of the two numbers, ignoring NaN. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -912,8 +912,8 @@ impl f64 { | ||
912 | 912 | #[stable(feature = "rust1", since = "1.0.0")] |
913 | 913 | #[inline] |
914 | 914 | pub fn to_radians(self) -> f64 { |
915 | -let value: f64 = consts::PI; | |
916 | -self * (value / 180.0) | |
915 | +const RADS_PER_DEG: f64 = consts::PI / 180.0; | |
916 | +self * RADS_PER_DEG | |
917 | 917 | } |
918 | 918 | |
919 | 919 | /// Returns the maximum of the two numbers, ignoring NaN. |