mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-31 17:31:06 +00:00
Add atan to Math
This commit is contained in:
parent
4b812ee47d
commit
7e514b939f
@ -273,6 +273,11 @@ extern {
|
|||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(static_method_of = Math)]
|
||||||
pub fn asinh(number: i32) -> Number;
|
pub fn asinh(number: i32) -> Number;
|
||||||
|
|
||||||
|
/// The Math.atan() function returns the arctangent (in radians) of a
|
||||||
|
/// number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that
|
||||||
|
/// tan(y) = x
|
||||||
|
#[wasm_bindgen(static_method_of = Math)]
|
||||||
|
pub fn atan(number: i32) -> Number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,3 +134,29 @@ fn asinh() {
|
|||||||
"#)
|
"#)
|
||||||
.test()
|
.test()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn atan() {
|
||||||
|
project()
|
||||||
|
.file("src/lib.rs", r#"
|
||||||
|
#![feature(proc_macro, wasm_custom_section)]
|
||||||
|
|
||||||
|
extern crate wasm_bindgen;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use wasm_bindgen::js;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn atan(number: i32) -> js::Number {
|
||||||
|
js::Math::atan(number)
|
||||||
|
}
|
||||||
|
"#)
|
||||||
|
.file("test.ts", r#"
|
||||||
|
import * as assert from "assert";
|
||||||
|
import * as wasm from "./out";
|
||||||
|
|
||||||
|
export function test() {
|
||||||
|
assert.equal(wasm.atan(1), Math.atan(1));
|
||||||
|
}
|
||||||
|
"#)
|
||||||
|
.test()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user