Skip to content

math:trig ..

NOPEname edited this page Jun 24, 2020 · 6 revisions

../sin_lt

-Calculates sine of given number using a lookup table

-Input: degree wrapped into [0..360]

-Output: integer, scaled by 1,000,000,000 (example: 936 stands for 0.000000936)

../cos_lt

-Uses ../sin_lt to calculate result

../sin_bs

-Calculates sine of given number using the Bhaskara-Stroethoff formula ( Source )

-Input: scaled by 100 & wrapped into [0..36000] (representing [0.00..360.00])

-Output: scaled by 10000 (example: 936 stands for 0.0936)

-Expected max error: 0.0005 (scaled to integer -> 5 )

../cos_bs

-Uses ../sin_bs to calculate result

../sin_et

-Calculates sine of given number using Minecraft commands (/tp, /scoreboard, /execute store)

-Input: scaled by 100000 & wrapped into [0..36000000] (representing [0.00000..360.00000])

-Output: scaled by 1000000 (example: 936 stands for 0.000936 )

../cos_et

-Uses ../sin_et to calculate result

Comparison:

(better > worse)

-Speed: _lt > _bs > _et

-Accuracy: _lt > _et > _bs

-Input range: _et > _bs > _lt

-> For most purposes _bs should be the best option. Choose _et only if high accuracy + big input range is needed. Choose _lt only if most accurate result is needed