Trigonometric functions: Difference between revisions

Updated D entry
m (→‎{{header|REXX}}: changed wording of some boxed comments. -- ~~~~)
(Updated D entry)
Line 620:
=={{header|D}}==
{{trans|C}}
<lang d>importvoid std.stdio,main() std.math;{
import std.stdio, std.math;
 
enum degrees = 45.0L;
void main() {
enum realt0 = degrees =* PI / 45180.00L;
enum real t0 = degrees * PI / 180.0;
writeln("Reference: 0.7071067811865475244008");
writefln("Sine: %.20f %.20f", sin(PI_4).sin, sin(t0).sin);
writefln("Cosine: %.20f %.20f", cos(PI_4).cos, cos(t0).cos);
writefln("Tangent: %.20f %.20f", tan(PI_4).tan, tan(t0).tan);
 
writeln();
writeln("Reference: 0.7853981633974483096156");
immutable real t1 = asin(sin(PI_4)).sin.asin;
writefln("Arcsine: %.20f %.20f", t1, t1 * 180.00L / PI);
 
immutable real t2 = acos(cos(PI_4)).cos.acos;
writefln("Arccosine: %.20f %.20f", t2, t2 * 180.00L / PI);
 
immutable real t3 = atan(tan(PI_4)).tan.atan;
writefln("Arctangent: %.20f %.20f", t3, t3 * 180.00L / PI);
}</lang>
{{out}}
Output:
<pre>Reference: 0.7071067811865475244008
Sine: 0.70710678118654752442 0.70710678118654752442