From dc59d7cac21a014a36202ef900d07fb9f035b3ac Mon Sep 17 00:00:00 2001 From: PaddiM8 Date: Sat, 30 May 2020 18:01:45 +0200 Subject: [PATCH] Added `hyp` function. --- src/prelude.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/prelude.rs b/src/prelude.rs index 006fb5d..be915a6 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -54,6 +54,7 @@ pub const UNARY_FUNCS: phf::Map<&'static str, UnaryFuncInfo> = phf::phf_map! { pub const BINARY_FUNCS: phf::Map<&'static str, BinaryFuncInfo> = phf::phf_map! { "max" => BinaryFuncInfo(max, Other), "min" => BinaryFuncInfo(min, Other), + "hyp" => BinaryFuncInfo(hyp, Other), "log" => BinaryFuncInfo(logx, Other), }; @@ -219,6 +220,10 @@ mod funcs { x.fract() } + pub fn hyp(x: f64, y: f64) -> f64 { + x.hypot(y) + } + pub fn log(x: f64) -> f64 { x.log(10f64) }