Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaddaaed

Browse files
committed
f32: use constants instead of reassigning a dummy value as PI
1 parent725b38e commitaddaaed

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎core/src/num/f32.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,8 @@ impl f32 {
901901
#[stable(feature ="f32_deg_rad_conversions", since ="1.7.0")]
902902
#[inline]
903903
pubfnto_radians(self) ->f32{
904-
let value:f32 = consts::PI;
905-
self*(value /180.0f32)
904+
constRADS_PER_DEG:f32 = consts::PI /180.0;
905+
self*RADS_PER_DEG
906906
}
907907

908908
/// Returns the maximum of the two numbers, ignoring NaN.

‎core/src/num/f64.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,8 @@ impl f64 {
912912
#[stable(feature ="rust1", since ="1.0.0")]
913913
#[inline]
914914
pubfnto_radians(self) ->f64{
915-
let value:f64 = consts::PI;
916-
self*(value /180.0)
915+
constRADS_PER_DEG:f64 = consts::PI /180.0;
916+
self*RADS_PER_DEG
917917
}
918918

919919
/// Returns the maximum of the two numbers, ignoring NaN.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp