3 ms·
Function sine(x As Double, Optional term, Optional p = 1#) As Double If IsMissing(term) Then term = x End If If ter
by perl4ever 7y ago
Function sine(x As Double, Optional term, Optional p = 1#) As Double
If IsMissing(term) Then
term = x
End If
If term <> 0 Then
sine = term + sine(x, -term * x / (p + 1) * x / (p + 2), p + 2)
End If
End Function
Edit:
This is my interpretation of the Taylor series approximation, but it's probably a bad idea to use this for anything that matters. One reason is that it doesn't reduce large angles, and another is that people who know what they're doing prefer to use some other formula, from a cursory Googling...though I'm not sure why.