initial commit

This commit is contained in:
2014-01-18 15:06:11 +01:00
parent 3fabb8dcf8
commit 768bec39b3
408 changed files with 171325 additions and 2 deletions

19
tools/fastcos.py Normal file
View File

@@ -0,0 +1,19 @@
import math
def sin(x):
B = 5215 # int((4.0/math.pi)*4096)
C = -1660 # int((-4.0/(math.pi*math.pi))*4096)
Q = 3174 # 0.775
P = 922 # 0.225
y = (B*x + ((C*x)>>12)*abs(x))>>12
y = (((P * (((y * abs(y))>>12) - y))>>12) + y)
return y
n = 200
for x in xrange(n):
i = -math.pi + x/100.0*math.pi
print "==== " + str(i)
print "fixed : " + str(int(sin(int(i*4096.0))))
print "math : " + str(int(math.sin(i)*4096.0))