mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-11 22:56:06 +00:00
Add atanh to Math
This commit is contained in:
parent
3223a9af75
commit
5eb744c7d6
@ -286,6 +286,14 @@ extern {
|
|||||||
#[wasm_bindgen(static_method_of = Math)]
|
#[wasm_bindgen(static_method_of = Math)]
|
||||||
pub fn atan2(y: i32, x: i32) -> Number;
|
pub fn atan2(y: i32, x: i32) -> Number;
|
||||||
|
|
||||||
|
/// The Math.atanh() function returns the hyperbolic arctangent of a number,
|
||||||
|
/// that is ∀x ∊ (-1,1), Math.atanh(x) = arctanh(x) = the unique y such that
|
||||||
|
/// tanh(y) = x
|
||||||
|
///
|
||||||
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh
|
||||||
|
#[wasm_bindgen(static_method_of = Math)]
|
||||||
|
pub fn atanh(x: i32) -> Number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number.
|
// Number.
|
||||||
|
@ -186,3 +186,29 @@ fn atan2() {
|
|||||||
"#)
|
"#)
|
||||||
.test()
|
.test()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn atanh() {
|
||||||
|
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 atanh(x: i32) -> js::Number {
|
||||||
|
js::Math::atanh(x)
|
||||||
|
}
|
||||||
|
"#)
|
||||||
|
.file("test.ts", r#"
|
||||||
|
import * as assert from "assert";
|
||||||
|
import * as wasm from "./out";
|
||||||
|
|
||||||
|
export function test() {
|
||||||
|
assert.equal(wasm.atanh(1), Math.atanh(1));
|
||||||
|
}
|
||||||
|
"#)
|
||||||
|
.test()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user