Add atan2 and hypot functions.

This commit is contained in:
Stephen Chung 2021-02-17 12:27:27 +08:00
parent 909d48caed
commit b2ca8c34d1
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,7 @@ Enhancements
------------
* Functions resolution cache is used in more cases, making repeated function calls faster.
* Added `atan(x, y)` and `hypot(x, y)` to `BasicMathPackage`.
Version 0.19.11

View File

@ -170,6 +170,10 @@ mod trig_functions {
pub fn atan(x: FLOAT) -> FLOAT {
x.atan()
}
#[rhai_fn(name = "atan")]
pub fn atan2(x: FLOAT, y: FLOAT) -> FLOAT {
x.atan2(y)
}
pub fn asinh(x: FLOAT) -> FLOAT {
x.asinh()
}
@ -179,6 +183,9 @@ mod trig_functions {
pub fn atanh(x: FLOAT) -> FLOAT {
x.atanh()
}
pub fn hypot(x: FLOAT, y: FLOAT) -> FLOAT {
x.hypot(y)
}
}
#[cfg(not(feature = "no_float"))]