From: Michael Nolan Date: Tue, 14 Apr 2020 13:46:23 +0000 (-0400) Subject: Add experiment testing the effects of adding extra bits to cordic X-Git-Tag: ls180-24jan2020~91 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b349c184c640d206db6b71680b02c83993df8de;p=ieee754fpu.git Add experiment testing the effects of adding extra bits to cordic --- diff --git a/src/ieee754/cordic/test/test_software.py b/src/ieee754/cordic/test/test_software.py new file mode 100644 index 00000000..d48eefb1 --- /dev/null +++ b/src/ieee754/cordic/test/test_software.py @@ -0,0 +1,31 @@ +import math +import unittest +from python_sin_cos import run_cordic +import random + +class SoftwareTestCase(unittest.TestCase): + def test_extrabits(self): + fracbits = 16 + extrabits = 18 + M = (1 << fracbits) + print(M) + for i in range(200000): + f = random.uniform(-math.pi/2, math.pi/2) + i = int(round(f * M)) + f = i/M + print(f"int: {i}, float:{f}") + i = i * (1<