Upgrade to rust-decimal 1.16 and add sin/cos/tan.

This commit is contained in:
Stephen Chung
2021-09-15 10:41:35 +08:00
parent bdbfa8ef5f
commit 5163fb0a33
3 changed files with 11 additions and 1 deletions

View File

@@ -325,6 +325,15 @@ mod decimal_functions {
}
}
pub fn sin(x: Decimal) -> Decimal {
x.sin()
}
pub fn cos(x: Decimal) -> Decimal {
x.cos()
}
pub fn tan(x: Decimal) -> Decimal {
x.tan()
}
#[rhai_fn(return_raw)]
pub fn sqrt(x: Decimal) -> Result<Decimal, Box<EvalAltResult>> {
x.sqrt()