@@ -8,7 +8,7 @@ namespace Math;
8
8
9
9
Computes the sine of @"x" (in radians).
10
10
11
- Please note that an input of @"PI" **will not** return exactly `0.0`.
11
+ Please note that an input of @"PI" **will not** return * exactly* `0.0`.
12
12
%/
13
13
func dec sin(dec x) {
14
14
// Special cases
@@ -67,7 +67,7 @@ func dec sin(dec x) {
67
67
68
68
Computes the cosine of @"x" (in radians).
69
69
70
- Please note that an input of @"PI" **will not** return exactly `-1.0`.
70
+ Please note that an input of @"PI" **will not** return * exactly* `-1.0`.
71
71
%/
72
72
func dec cos(dec x) {
73
73
ret sin(x + PI / 2.0);
@@ -79,8 +79,44 @@ func dec cos(dec x) {
79
79
80
80
Computes the tanget of @"x" (in radians).
81
81
82
- Please note that an input of @"PI" **will not** return exactly `0.0`.
82
+ Please note that an input of @"PI" **will not** return * exactly* `0.0`.
83
83
%/
84
84
func dec tan(dec x) {
85
85
ret sin(x) / cos(x);
86
+ }
87
+
88
+ /%
89
+ @approx: This function uses the Taylor series expansion of sine. This function
90
+ is not 100% accurate but will provide a very good approximation.
91
+
92
+ Computes the cosecant of @"x" (in radians).
93
+
94
+ Please note that an input of @"PI" **will not** return *exactly* `0.0`.
95
+ %/
96
+ func dec csc(dec x) {
97
+ ret 1.0 / sin(x);
98
+ }
99
+
100
+ /%
101
+ @approx: This function uses the Taylor series expansion of sine. This function
102
+ is not 100% accurate but will provide a very good approximation.
103
+
104
+ Computes the secant of @"x" (in radians).
105
+
106
+ Please note that an input of @"PI" **will not** return *exactly* `0.0`.
107
+ %/
108
+ func dec sec(dec x) {
109
+ ret 1.0 / cos(x);
110
+ }
111
+
112
+ /%
113
+ @approx: This function uses the Taylor series expansion of sine. This function
114
+ is not 100% accurate but will provide a very good approximation.
115
+
116
+ Computes the cotangent of @"x" (in radians).
117
+
118
+ Please note that an input of @"PI" **will not** return *exactly* `0.0`.
119
+ %/
120
+ func dec cot(dec x) {
121
+ ret 1.0 / tan(x);
86
122
}
0 commit comments