1 of 10

# Fast Trig [sandboxing]

THIS QUESTION IS NOT FINISHED, PLEASE DO NOT POST ANSWERS UNTIL THIS MESSAGE IS REMOVED. UPVOTE IF YOU THINK IT'S READY TO START, COMMENT IF YOU SEE ANY PROBLEMS.

I am testing this sandbox system to see how it compares to the sandbox on the meta site.

# Fast Trigonometry Calculations

Your task is to create a program which can calculate the sine, cosine and tangent of an angle in degrees.

## Rules

• No built-in trigonometry functions (not even secant, cosecant and cotangent if your language has them).
• Do not hardcode the output (e.g. by having an array of all the values).
• No network access.
• You must correctly round your output as explained below. Don't use floor or ceiling.
• You may use any method to calculate the values, for example continued fractions, as long as they are correct to 4 significant figures.
• Standard loopholes apply.

## Input Format

• Input will consist of angles to six significant figures in decimal digits, separated by new lines. For example:

90.0000
74.5439
175.500

## Output Format

• For each angle supplied, you must output its sine, cosine and tangent to 3 significant figures, separated by spaces, on a single line.
• If the input is three angles separated by newlines, your output should consist of three lines, each containing the sine, cosine and tangent.
• You may not output anything else.
• Output to standard output unless your language does not support it.

## Scoring

• . The challenge is to write a program which computes these three values as quickly as possible. Fastest time wins.
• Everyone will receive the same test input of many angles.
• Times will be recorded using the time Unix command, on my machine.
• Your score is the average of three runs on the same input (you can't save anything in between runs obviously).
• Compiling time not included. This challenge is more about the method used than the language. (If someone could point me to how I would exclude compilation time for languages such as Java, I'd be very grateful)
• My machine is an Ubuntu 14.04 install. The processor's stats are on Pastebin (obtained by running cat /proc/cpuinfo).