Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1bd684

Browse files
committed
Add trigonometric functions that work in degrees.
The implementations go to some lengths to deliver exact results for valueswhere an exact result can be expected, such as sind(30) = 0.5 exactly.Dean Rasheed, reviewed by Michael Paquier
1 parentfd5200c commite1bd684

File tree

10 files changed

+860
-9
lines changed

10 files changed

+860
-9
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,20 +1006,19 @@
10061006
Finally, <xref linkend="functions-math-trig-table"> shows the
10071007
available trigonometric functions. All trigonometric functions
10081008
take arguments and return values of type <type>double
1009-
precision</type>. Trigonometric functions arguments are expressed
1010-
in radians. Inverse functions return values are expressed in
1011-
radians. See unit transformation functions
1012-
<literal><function>radians()</function></literal> and
1013-
<literal><function>degrees()</function></literal> above.
1009+
precision</type>. Each of the trigonometric functions comes in
1010+
two variants, one that measures angles in radians and one that
1011+
measures angles in degrees.
10141012
</para>
10151013

10161014
<table id="functions-math-trig-table">
10171015
<title>Trigonometric Functions</title>
10181016

1019-
<tgroup cols="2">
1017+
<tgroup cols="3">
10201018
<thead>
10211019
<row>
1022-
<entry>Function</entry>
1020+
<entry>Function (radians)</entry>
1021+
<entry>Function (degrees)</entry>
10231022
<entry>Description</entry>
10241023
</row>
10251024
</thead>
@@ -1031,6 +1030,11 @@
10311030
<primary>acos</primary>
10321031
</indexterm><literal><function>acos(<replaceable>x</replaceable>)</function></literal>
10331032
</entry>
1033+
<entry>
1034+
<indexterm>
1035+
<primary>acosd</primary>
1036+
</indexterm><literal><function>acosd(<replaceable>x</replaceable>)</function></literal>
1037+
</entry>
10341038
<entry>inverse cosine</entry>
10351039
</row>
10361040

@@ -1041,6 +1045,12 @@
10411045
</indexterm>
10421046
<literal><function>asin(<replaceable>x</replaceable>)</function></literal>
10431047
</entry>
1048+
<entry>
1049+
<indexterm>
1050+
<primary>asind</primary>
1051+
</indexterm>
1052+
<literal><function>asind(<replaceable>x</replaceable>)</function></literal>
1053+
</entry>
10441054
<entry>inverse sine</entry>
10451055
</row>
10461056

@@ -1051,6 +1061,12 @@
10511061
</indexterm>
10521062
<literal><function>atan(<replaceable>x</replaceable>)</function></literal>
10531063
</entry>
1064+
<entry>
1065+
<indexterm>
1066+
<primary>atand</primary>
1067+
</indexterm>
1068+
<literal><function>atand(<replaceable>x</replaceable>)</function></literal>
1069+
</entry>
10541070
<entry>inverse tangent</entry>
10551071
</row>
10561072

@@ -1062,6 +1078,13 @@
10621078
<literal><function>atan2(<replaceable>y</replaceable>,
10631079
<replaceable>x</replaceable>)</function></literal>
10641080
</entry>
1081+
<entry>
1082+
<indexterm>
1083+
<primary>atan2d</primary>
1084+
</indexterm>
1085+
<literal><function>atan2d(<replaceable>y</replaceable>,
1086+
<replaceable>x</replaceable>)</function></literal>
1087+
</entry>
10651088
<entry>inverse tangent of
10661089
<literal><replaceable>y</replaceable>/<replaceable>x</replaceable></literal></entry>
10671090
</row>
@@ -1073,6 +1096,12 @@
10731096
</indexterm>
10741097
<literal><function>cos(<replaceable>x</replaceable>)</function></literal>
10751098
</entry>
1099+
<entry>
1100+
<indexterm>
1101+
<primary>cosd</primary>
1102+
</indexterm>
1103+
<literal><function>cosd(<replaceable>x</replaceable>)</function></literal>
1104+
</entry>
10761105
<entry>cosine</entry>
10771106
</row>
10781107

@@ -1083,6 +1112,12 @@
10831112
</indexterm>
10841113
<literal><function>cot(<replaceable>x</replaceable>)</function></literal>
10851114
</entry>
1115+
<entry>
1116+
<indexterm>
1117+
<primary>cotd</primary>
1118+
</indexterm>
1119+
<literal><function>cotd(<replaceable>x</replaceable>)</function></literal>
1120+
</entry>
10861121
<entry>cotangent</entry>
10871122
</row>
10881123

@@ -1093,6 +1128,12 @@
10931128
</indexterm>
10941129
<literal><function>sin(<replaceable>x</replaceable>)</function></literal>
10951130
</entry>
1131+
<entry>
1132+
<indexterm>
1133+
<primary>sind</primary>
1134+
</indexterm>
1135+
<literal><function>sind(<replaceable>x</replaceable>)</function></literal>
1136+
</entry>
10961137
<entry>sine</entry>
10971138
</row>
10981139

@@ -1103,12 +1144,29 @@
11031144
</indexterm>
11041145
<literal><function>tan(<replaceable>x</replaceable>)</function></literal>
11051146
</entry>
1147+
<entry>
1148+
<indexterm>
1149+
<primary>tand</primary>
1150+
</indexterm>
1151+
<literal><function>tand(<replaceable>x</replaceable>)</function></literal>
1152+
</entry>
11061153
<entry>tangent</entry>
11071154
</row>
11081155
</tbody>
11091156
</tgroup>
11101157
</table>
11111158

1159+
<note>
1160+
<para>
1161+
Another way to work with angles measured in degrees is to use the unit
1162+
transformation functions <literal><function>radians()</function></literal>
1163+
and <literal><function>degrees()</function></literal> shown earlier.
1164+
However, using the degree-based trigonometric functions is preferred,
1165+
as that way avoids roundoff error for special cases such
1166+
as <literal>sind(30)</>.
1167+
</para>
1168+
</note>
1169+
11121170
</sect1>
11131171

11141172

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp