File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,14 @@ extern {
286
286
#[ wasm_bindgen( static_method_of = Math ) ]
287
287
pub fn atan2 ( y : i32 , x : i32 ) -> Number ;
288
288
289
+ /// The Math.atanh() function returns the hyperbolic arctangent of a number,
290
+ /// that is ∀x ∊ (-1,1), Math.atanh(x) = arctanh(x) = the unique y such that
291
+ /// tanh(y) = x
292
+ ///
293
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh
294
+ #[ wasm_bindgen( static_method_of = Math ) ]
295
+ pub fn atanh ( x : i32 ) -> Number ;
296
+
289
297
}
290
298
291
299
// Number.
Original file line number Diff line number Diff line change @@ -186,3 +186,29 @@ fn atan2() {
186
186
"# )
187
187
. test ( )
188
188
}
189
+
190
+ #[ test]
191
+ fn atanh ( ) {
192
+ project ( )
193
+ . file ( "src/lib.rs" , r#"
194
+ #![feature(proc_macro, wasm_custom_section)]
195
+
196
+ extern crate wasm_bindgen;
197
+ use wasm_bindgen::prelude::*;
198
+ use wasm_bindgen::js;
199
+
200
+ #[wasm_bindgen]
201
+ pub fn atanh(x: i32) -> js::Number {
202
+ js::Math::atanh(x)
203
+ }
204
+ "# )
205
+ . file ( "test.ts" , r#"
206
+ import * as assert from "assert";
207
+ import * as wasm from "./out";
208
+
209
+ export function test() {
210
+ assert.equal(wasm.atanh(1), Math.atanh(1));
211
+ }
212
+ "# )
213
+ . test ( )
214
+ }
You can’t perform that action at this time.
0 commit comments