Browse Source

added test for conversion of zero degrees to radians as well as corresponding functionality

remotes/origin/feature/feature-trigonometry
fdai7764 11 months ago
parent
commit
3536cc8702
  1. 3
      src/main/py/trigonometry.py
  2. 3
      src/test/py/test_trigonometry.py

3
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

3
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)

Loading…
Cancel
Save