File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,12 @@ public static partial class PythonMath {
30
30
public const double e = Math . E ;
31
31
32
32
private const double degreesToRadians = Math . PI / 180.0 ;
33
+ private const double radiansToDegrees = 180.0 / Math . PI ;
34
+
33
35
private const int Bias = 0x3FE ;
34
36
35
37
public static double degrees ( double radians ) {
36
- return Check ( radians , radians / degreesToRadians ) ;
38
+ return Check ( radians , radians * radiansToDegrees ) ;
37
39
}
38
40
39
41
public static double radians ( double degrees ) {
Original file line number Diff line number Diff line change @@ -718,4 +718,10 @@ def test_integer_ratio(self):
718
718
for flt , res in int_ratio_tests :
719
719
self .assertEqual (flt .as_integer_ratio (), res )
720
720
721
+ def test_degrees (self ):
722
+ # check that IronPython is doing the same conversion as CPython
723
+ self .assertNotEqual (0.06825994771674652 / (math .pi / 180 ), 0.06825994771674652 * (180 / math .pi ))
724
+ self .assertEqual (0.06825994771674652 * (180 / math .pi ), 3.911006913953236 )
725
+ self .assertEqual (math .degrees (0.06825994771674652 ), 3.911006913953236 )
726
+
721
727
run_test (__name__ )
You can’t perform that action at this time.
0 commit comments