2 ms·
polynomials are still king. a 6th degree polynomial is often enough and will be faster than a 2nd degree rational.
by adgjlsfhk1 4y ago
polynomials are still king. a 6th degree polynomial is often enough and will be faster than a 2nd degree rational.
- pclmulqdq 4y agoA 6th degree polynomial is firmly in the "fast approximation" category. I think sin/cos are ~15th degree polynomials for 1 ULP of precision.
- moonchild 4y agohttps://github.com/rutgers-apl/The-RLIBM-Project/blob/main/libm/sinf.c https://github.com/rutgers-apl/The-RLIBM-Project/blob/main/l... has a lot less and claims to be correctly rounded.
- pclmulqdq 4y agoFor 32-bit float, yes. For double precision, not so much.
- adgjlsfhk1 4y agosin/cos commonly use 2 different 5th degree polynomials (depending on quadrant of the sin graph) https://github.com/JuliaLang/julia/blob/bb83df1d61fb649efd155a1bf32a2f436aecced9/base/special/trig.jl#L69 https://github.com/JuliaLang/julia/blob/bb83df1d61fb649efd15...