At start up - why not create a 0-89 indexed float array and store the value of the sin at each index. Then when you want to use the value - it's just a simple lookup - no computation. You just need to do some manipulation of the index - so for 100deg look up the 80 degree value - and for > 180 flip the sign...
The compares might be slower so you could store the whole array - or 0-179.
You could even store fixed point values rather than floating point.
© Espruino, powered by microcosm.
Report a problem