From 6d390a03367544fb7a824ae7825ed333903f255f Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Wed, 27 Mar 2019 14:12:51 +0530 Subject: add rad(), deg() and abs() functions --- src/lex/mod.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/lex/mod.rs b/src/lex/mod.rs index e12f327..8348e72 100644 --- a/src/lex/mod.rs +++ b/src/lex/mod.rs @@ -87,6 +87,9 @@ fn get_functions() -> HashMap<&'static str, Token> { ("sqrt", Function::token_from_fn("sqrt".into(), |x| x.sqrt())), ("ceil", Function::token_from_fn("ceil".into(), |x| x.ceil())), ("floor", Function::token_from_fn("floor".into(), |x| x.floor())), + ("rad", Function::token_from_fn("rad".into(), |x| x.to_radians())), + ("deg", Function::token_from_fn("deg".into(), |x| x.to_degrees())), + ("abs", Function::token_from_fn("abs".into(), |x| x.abs())), // single arg functions can be added here ].iter().cloned().collect(); } -- cgit v1.2.3