diff --git a/src/main/py/trigonometry.py b/src/main/py/trigonometry.py index 79eb798..3bfddac 100644 --- a/src/main/py/trigonometry.py +++ b/src/main/py/trigonometry.py @@ -14,6 +14,9 @@ def pi_approx_leibniz(precision): def rad2deg(radNumber): return (radNumber * 180) / math.pi +def deg2rad(degNumber): + return degNumber + def sin_approx_bhaskara(radNumber): shallFlipTheResult = False #the bhaskara function can only be used between zero and pi. For the rest of the sin period I simply mirrored the first arch of the curve to match the actual sine wave diff --git a/src/test/py/test_trigonometry.py b/src/test/py/test_trigonometry.py index ea90e73..9045e49 100644 --- a/src/test/py/test_trigonometry.py +++ b/src/test/py/test_trigonometry.py @@ -37,6 +37,9 @@ class MyTestCase(unittest.TestCase): delta *= -1 self.assertLess(delta, 0.01) + def test_0_deg_to_rad_should_be_0(self): + self.assertEqual(deg2rad(0), 0) + def test_sin_0_should_be_0(self): self.assertEqual(sin_approx_bhaskara(0), 0)