Improved numerical accuracy with trigonometry functions in Applescript

Hello.

The number of significant digits in AppleScript is sometimes to small to obtain precise results, when the numbers are big. A trick is then to rewrite the formulae to obtain precision. Normally you won’t have to take this into account, but if your numbers are huge, or very small, then you may have to take such measures, to get good results as described below.

For instance: If the angle may close into 0 degrees, then sin^2( ∂/2) gives a much better result than 1 - cos( ∂ ).

And so on.

Here is a list over interesting articles that shows you different trigonometric functions/identities.

The Haver sine formula

Haversine

10 secret trig-functions (Scientific American).