5 ms·
>I couldn't find any notable projects on GitHub that use a table for trig functions, but I'm sure they exist. Doom?
by naoqj 5y ago
>I couldn't find any notable projects on GitHub that use a table for trig functions, but I'm sure they exist.
Doom?
- freemint 5y agoJulia?
- adgjlsfhk1 5y agoJulia uses a very similar approach to musl here. Reduction mod 2pi followed by polynomial kernel. We use tables for `exp` and `log`, but the trig functions have good reductions so we use those instead. The implementation is here https://github.com/JuliaLang/julia/blob/03af78108afe6058f54cf766d8981d26a11c51f7/base/special/trig.jl#L29 https://github.com/JuliaLang/julia/blob/03af78108afe6058f54c... for anyone interested.
- snicker7 5y agoIn the Julia repl, just type '@less sin(pi)' to view the source code of sin. I don't know of any other programming language that makes it this easy to look at its internals.
- adgjlsfhk1 5y agoThat's how we nerd snipe people into contributing to Base (only 10% joking).
- zekica 5y agoDoom also uses the famous fast inverse square root method which although I know how it works still amazes me.
- naoqj 5y agoIt doesn't, to the best of my knowledge. It appeared in an id game for the first time in Quake 3.
- spacechild1 5y agoPure Data: https://github.com/pure-data/pure-data/blob/18c9695ba4de543c51c2c013b45b99b8f1c35a19/src/d_osc.c#L263-L319 https://github.com/pure-data/pure-data/blob/18c9695ba4de543c... SuperCollider: https://github.com/supercollider/supercollider/blob/ec2dedfda8d6bfa0ee1171158e38023ec6b4a4de/server/plugins/OscUGens.cpp#L1199 https://github.com/supercollider/supercollider/blob/ec2dedfd...