@@ -89,3 +89,115 @@ pub fn cos(self : Double) -> Double = "Math" "cos"
89
89
/// }
90
90
/// ```
91
91
pub fn tan (self : Double ) -> Double = "Math" "tan"
92
+
93
+ ///|
94
+ /// Calculates the arcsine of a number. Handles special cases and edge conditions
95
+ /// according to IEEE 754 standards.
96
+ ///
97
+ /// Parameters:
98
+ ///
99
+ /// * `x` : The number for which to calculate the arcsine.
100
+ ///
101
+ /// Returns the arcsine of the number `x`.
102
+ ///
103
+ /// * Returns NaN if the input is NaN.
104
+ /// * Returns NaN if the input is less than -1 or greater than 1.
105
+ ///
106
+ /// Example:
107
+ ///
108
+ /// ```moonbit
109
+ /// test "asin" {
110
+ /// inspect!(0.0.asin(), content="0")
111
+ /// inspect!(1.0.asin(), content="1.5707963267948966")
112
+ /// inspect!((-1.0).asin(), content="-1.5707963267948966")
113
+ /// inspect!(@double.not_a_number.asin(), content="NaN")
114
+ /// inspect!(@double.infinity.asin(), content="NaN")
115
+ /// inspect!(@double.neg_infinity.asin(), content="NaN")
116
+ /// }
117
+ /// ```
118
+ pub fn asin (self : Double ) -> Double = "Math" "asin"
119
+
120
+ ///|
121
+ /// Calculates the arccosine of a number.
122
+ ///
123
+ /// Parameters:
124
+ ///
125
+ /// * `x` : The number for which to calculate the arccosine.
126
+ ///
127
+ /// Returns the arccosine of the number `x`.
128
+ ///
129
+ /// * Returns NaN if the input is NaN.
130
+ /// * Returns NaN if the input is less than -1 or greater than 1.
131
+ ///
132
+ /// Example:
133
+ ///
134
+ /// ```moonbit
135
+ /// test "acos" {
136
+ /// inspect!(0.0.acos(), content="1.5707963267948966")
137
+ /// inspect!(1.0.acos(), content="0")
138
+ /// inspect!((-1.0).acos(), content="3.141592653589793")
139
+ /// inspect!(@double.not_a_number.acos(), content="NaN")
140
+ /// inspect!(@double.infinity.acos(), content="NaN")
141
+ /// inspect!(@double.neg_infinity.acos(), content="NaN")
142
+ /// inspect!(0.0.acos(), content="1.5707963267948966")
143
+ /// }
144
+ /// ```
145
+ pub fn acos (self : Double ) -> Double = "Math" "acos"
146
+
147
+ ///|
148
+ /// Calculates the arctangent of a number.
149
+ ///
150
+ /// Parameters:
151
+ ///
152
+ /// * `x` : The number for which to calculate the arctangent.
153
+ ///
154
+ /// Returns the arctangent of the number `x`.
155
+ ///
156
+ /// Example:
157
+ ///
158
+ /// * Returns NaN if the input is NaN.
159
+ ///
160
+ /// ```moonbit
161
+ /// test "atan" {
162
+ /// inspect!(0.0.atan(), content="0")
163
+ /// inspect!(1.0.atan(), content="0.7853981633974483")
164
+ /// inspect!((-1.0).atan(), content="-0.7853981633974483")
165
+ /// inspect!(@double.not_a_number.atan(), content="NaN")
166
+ /// inspect!(@double.infinity.atan(), content="1.5707963267948966")
167
+ /// inspect!(@double.neg_infinity.atan(), content="-1.5707963267948966")
168
+ /// }
169
+ /// ```
170
+ pub fn atan (self : Double ) -> Double = "Math" "atan"
171
+
172
+ ///|
173
+ /// Calculates the arctangent of the quotient of two numbers.
174
+ ///
175
+ /// Parameters:
176
+ ///
177
+ /// * `self` : The numerator of the quotient.
178
+ /// * `x` : The denominator of the quotient.
179
+ ///
180
+ /// Returns the arctangent of the quotient `self / x`.
181
+ ///
182
+ /// * Returns NaN if self or x is NaN.
183
+ ///
184
+ /// Example:
185
+ ///
186
+ /// ```moonbit
187
+ /// test "atan2" {
188
+ /// inspect!(0.0.atan2(-1.0), content="3.141592653589793")
189
+ /// inspect!(1.0.atan2(0.0), content="1.5707963267948966")
190
+ /// inspect!(1.0.atan2(1.0), content="0.7853981633974483")
191
+ /// inspect!(not_a_number.atan2(1.0), content="NaN")
192
+ /// inspect!(1.0.atan2(not_a_number), content="NaN")
193
+ /// inspect!(infinity.atan2(1.0), content="1.5707963267948966")
194
+ /// inspect!(1.0.atan2(infinity), content="0")
195
+ /// inspect!(neg_infinity.atan2(1.0), content="-1.5707963267948966")
196
+ /// inspect!(1.0.atan2(neg_infinity), content="3.141592653589793")
197
+ /// inspect!(infinity.atan2(infinity), content="0.7853981633974483")
198
+ /// inspect!(neg_infinity.atan2(neg_infinity), content="-2.356194490192345")
199
+ /// inspect!(infinity.atan2(neg_infinity), content="2.356194490192345")
200
+ /// inspect!(neg_infinity.atan2(infinity), content="-0.7853981633974483")
201
+ /// }
202
+ /// ```
203
+ pub fn atan2 (self : Double , x : Double ) -> Double = "Math" "atan2"
0 commit comments