From b04d5702719eca30a95d1db2a927b6605ebd3477 Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Mon, 10 Feb 2025 01:12:55 -0700 Subject: Some fast math stuff added --- tables/trig_tables.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tables/trig_tables.py (limited to 'tables/trig_tables.py') diff --git a/tables/trig_tables.py b/tables/trig_tables.py new file mode 100755 index 0000000..7425f70 --- /dev/null +++ b/tables/trig_tables.py @@ -0,0 +1,28 @@ +#! /usr/bin/python3 + +from math import * + +table_size = 361 +line_spacing = 5 + +def make_table(func): + for c in range(table_size): + print(f"{func(radians(c))},", end="") + + if c % line_spacing == 0: + print() + + print("};\n") + +# Sin. +print("float sldjSinTable[%d] = {" % table_size) +make_table(sin) + +# Cos. +print("float sldjCosTable[%d] = {" % table_size) +make_table(cos) + +# Tan +print("float sldjTanTable[%d] = {" % table_size) +make_table(tan) + -- cgit v1.2.3