chrisdew - 4 months ago 34

C Question

I'm looking for an approximation for Sine which is correct at

`x == 0`

`x == 90`

`x == pi/2`

I have no space for look-up tables.

Answer

You seem to be able to use Bhaskara I's sine approximation formula :

```
float x;
float sinx = 4 * x * (180 - x) / (40500 - x * (180 - x));
```

The error stays within 2%.

Very fast and can be optimized (by hand).