File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,11 @@ extern {
273
273
#[ wasm_bindgen( static_method_of = Math ) ]
274
274
pub fn asinh ( number : i32 ) -> Number ;
275
275
276
+ /// The Math.atan() function returns the arctangent (in radians) of a
277
+ /// number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that
278
+ /// tan(y) = x
279
+ #[ wasm_bindgen( static_method_of = Math ) ]
280
+ pub fn atan ( number : i32 ) -> Number ;
276
281
277
282
}
278
283
Original file line number Diff line number Diff line change @@ -134,3 +134,29 @@ fn asinh() {
134
134
"# )
135
135
. test ( )
136
136
}
137
+
138
+ #[ test]
139
+ fn atan ( ) {
140
+ project ( )
141
+ . file ( "src/lib.rs" , r#"
142
+ #![feature(proc_macro, wasm_custom_section)]
143
+
144
+ extern crate wasm_bindgen;
145
+ use wasm_bindgen::prelude::*;
146
+ use wasm_bindgen::js;
147
+
148
+ #[wasm_bindgen]
149
+ pub fn atan(number: i32) -> js::Number {
150
+ js::Math::atan(number)
151
+ }
152
+ "# )
153
+ . file ( "test.ts" , r#"
154
+ import * as assert from "assert";
155
+ import * as wasm from "./out";
156
+
157
+ export function test() {
158
+ assert.equal(wasm.atan(1), Math.atan(1));
159
+ }
160
+ "# )
161
+ . test ( )
162
+ }
You can’t perform that action at this time.
0 commit comments