This commit is contained in:
Miloslav Ciz 2023-12-19 13:00:12 +01:00
parent 8b06e864aa
commit 02871374cc
6 changed files with 33 additions and 30 deletions

4
sin.md
View file

@ -142,6 +142,10 @@ int sinA(int x)
}
```
Sine can also be surprisingly accurately approximated with the [smoothstep](smoothstep.md) function, which is just a polynomial *3 * x^2 - 2 * x^3*.
TODO: code for that
Furthermore there exist other nice approximations, such as the extremely accurate **Bhaskara I's approximation** (angle in radians): *sin(x) ~= (16 * x * (pi - x)) / (5 * pi^2 - 4 * x * (pi - x))*. (This formula is actually more elegant for cosine, so it may be even better to consider using that.) Here is a [C](c.md) [fixed point](fixed_point.md) implementation:
```