mirror of https://github.com/rust-lang/rust.git
Rollup merge of #125571 - tesuji:dummy-pi, r=Nilstrieb
f32: use constants instead of reassigning a dummy value as PI
This commit is contained in:
commit
27cdb36ec5
|
@ -901,8 +901,8 @@ impl f32 {
|
|||
#[stable(feature = "f32_deg_rad_conversions", since = "1.7.0")]
|
||||
#[inline]
|
||||
pub fn to_radians(self) -> f32 {
|
||||
let value: f32 = consts::PI;
|
||||
self * (value / 180.0f32)
|
||||
const RADS_PER_DEG: f32 = consts::PI / 180.0;
|
||||
self * RADS_PER_DEG
|
||||
}
|
||||
|
||||
/// Returns the maximum of the two numbers, ignoring NaN.
|
||||
|
|
|
@ -912,8 +912,8 @@ impl f64 {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn to_radians(self) -> f64 {
|
||||
let value: f64 = consts::PI;
|
||||
self * (value / 180.0)
|
||||
const RADS_PER_DEG: f64 = consts::PI / 180.0;
|
||||
self * RADS_PER_DEG
|
||||
}
|
||||
|
||||
/// Returns the maximum of the two numbers, ignoring NaN.
|
||||
|
|
Loading…
Reference in New Issue