Trigonometric functions: Difference between revisions

Added Easylang
(RPL: add section)
(Added Easylang)
(2 intermediate revisions by 2 users not shown)
Line 1,106:
Arccosine: 0.78539816339744830961 45.00000000000000000000
Arctangent: 0.78539816339744830961 45.00000000000000000000</pre>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
 
 
<syntaxhighlight lang="Delphi">
 
procedure ShowTrigFunctions(Memo: TMemo);
const AngleDeg = 45.0;
var AngleRad,ArcSine,ArcCosine,ArcTangent: double;
begin
AngleRad:=DegToRad(AngleDeg);
 
Memo.Lines.Add(Format('Angle: Degrees: %3.5f Radians: %3.6f',[AngleDeg,AngleRad]));
Memo.Lines.Add('-------------------------------------------------');
Memo.Lines.Add(Format('Sine: Degrees: %3.6f Radians: %3.6f',[sin(DegToRad(AngleDeg)),sin(AngleRad)]));
Memo.Lines.Add(Format('Cosine: Degrees: %3.6f Radians: %3.6f',[cos(DegToRad(AngleDeg)),cos(AngleRad)]));
Memo.Lines.Add(Format('Tangent: Degrees: %3.6f Radians: %3.6f',[tan(DegToRad(AngleDeg)),tan(AngleRad)]));
ArcSine:=ArcSin(Sin(AngleRad));
Memo.Lines.Add(Format('Arcsine: Degrees: %3.6f Radians: %3.6f',[DegToRad(ArcSine),ArcSine]));
ArcCosine:=ArcCos(cos(AngleRad));
Memo.Lines.Add(Format('Arccosine: Degrees: %3.6f Radians: %3.6f',[DegToRad(ArcCosine),ArcCosine]));
ArcTangent:=ArcTan(tan(AngleRad));
Memo.Lines.Add(Format('Arctangent: Degrees: %3.6f Radians: %3.6f',[DegToRad(ArcTangent),ArcTangent]));
end;
 
 
 
</syntaxhighlight>
{{out}}
<pre>
Angle: Degrees: 45.00000 Radians: 0.785398
-------------------------------------------------
Sine: Degrees: 0.707107 Radians: 0.707107
Cosine: Degrees: 0.707107 Radians: 0.707107
Tangent: Degrees: 1.000000 Radians: 1.000000
Arcsine: Degrees: 0.013708 Radians: 0.785398
Arccosine: Degrees: 0.013708 Radians: 0.785398
Arctangent: Degrees: 0.013708 Radians: 0.785398
 
Elapsed Time: 9.118 ms.
 
</pre>
 
 
=={{header|E}}==
Line 1,134 ⟶ 1,179:
0.7853981633974483 45.0
0.7853981633974483 45.0
 
=={{header|EasyLang}}==
<syntaxhighlight>
r = pi / 4
d = 45
#
func r2d r .
return r / pi * 180
.
func d2r d .
return d * pi / 180
.
#
numfmt 4 0
print sin d & " " & sin r2d r
print cos d & " " & cos r2d r
print tan d & " " & tan r2d r
print ""
h = asin sin d
print h & " " & d2r h
h = acos cos d
print h & " " & d2r h
h = atan tan d
print h & " " & d2r h
</syntaxhighlight>
 
{{out}}
<pre>
0.7071 0.7071
0.7071 0.7071
1.0000 1.0000
 
45.0000 0.7854
45 0.7854
45 0.7854
</pre>
 
=={{header|Elena}}==
Line 5,478 ⟶ 5,559:
{{trans|Go}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
 
var d = 30
2,069

edits