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 @@ -258,6 +258,14 @@ extern {
258
258
#[ wasm_bindgen( static_method_of = Math ) ]
259
259
pub fn acosh ( number : i32 ) -> Number ;
260
260
261
+ /// The Math.asin() function returns the arcsine (in radians) of a
262
+ /// number, that is ∀x ∊ [-1;1]
263
+ /// Math.asin(x) = arcsin(x) = the unique y∊[-π2;π2] such that sin(y) = x
264
+ ///
265
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin
266
+ #[ wasm_bindgen( static_method_of = Math ) ]
267
+ pub fn asin ( number : i32 ) -> Number ;
268
+
261
269
}
262
270
263
271
// Number.
Original file line number Diff line number Diff line change @@ -82,3 +82,29 @@ fn acosh() {
82
82
"# )
83
83
. test ( )
84
84
}
85
+
86
+ #[ test]
87
+ fn asin ( ) {
88
+ project ( )
89
+ . file ( "src/lib.rs" , r#"
90
+ #![feature(proc_macro, wasm_custom_section)]
91
+
92
+ extern crate wasm_bindgen;
93
+ use wasm_bindgen::prelude::*;
94
+ use wasm_bindgen::js;
95
+
96
+ #[wasm_bindgen]
97
+ pub fn asin(opposite: i32, hypotenuse: i32) -> js::Number {
98
+ js::Math::asin(opposite / hypotenuse)
99
+ }
100
+ "# )
101
+ . file ( "test.ts" , r#"
102
+ import * as assert from "assert";
103
+ import * as wasm from "./out";
104
+
105
+ export function test() {
106
+ assert.equal(wasm.asin(1, 1), Math.asin(1));
107
+ }
108
+ "# )
109
+ . test ( )
110
+ }
You can’t perform that action at this time.
0 commit comments