From ae4778d7a3f4dacde39232b503bd134ce71444ee Mon Sep 17 00:00:00 2001 From: Karen Sargsyan Date: Mon, 23 May 2016 17:40:19 +0800 Subject: abs and floor added --- src/c/urweb.c | 8 ++++++++ src/settings.sml | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/c/urweb.c b/src/c/urweb.c index c6f6220c..6eb3c21c 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -4517,6 +4517,10 @@ uw_Basis_int uw_Basis_round(uw_context ctx, uw_Basis_float n) { return round(n); } +uw_Basis_int uw_Basis_floor(uw_context ctx, uw_Basis_float n) { + return floor(n); +} + uw_Basis_float uw_Basis_pow(uw_context ctx, uw_Basis_float n, uw_Basis_float m) { return pow(n,m); } @@ -4557,6 +4561,10 @@ uw_Basis_float uw_Basis_atan2(uw_context ctx, uw_Basis_float n, uw_Basis_float m return atan2(n, m); } +uw_Basis_float uw_Basis_abs(uw_context ctx, uw_Basis_float n) { + return fabs(n); +} + uw_Basis_string uw_Basis_atom(uw_context ctx, uw_Basis_string s) { char *p; diff --git a/src/settings.sml b/src/settings.sml index 4b326da8..b72789df 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -335,6 +335,7 @@ val jsFuncsBase = basisM [("alert", "alert"), ("ceil", "ceil"), ("trunc", "trunc"), ("round", "round"), + ("floor", "floor"), ("pow", "pow"), ("sqrt", "sqrt"), @@ -346,6 +347,7 @@ val jsFuncsBase = basisM [("alert", "alert"), ("acos", "acos"), ("atan", "atan"), ("atan2", "atan2"), + ("abs", "abs"), ("now", "now"), ("timeToString", "showTime"), -- cgit v1.2.3