diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/urweb.js | 19 | ||||
-rw-r--r-- | lib/ur/basis.urs | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index d7149eba..1cfbf0ca 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -93,6 +93,25 @@ function length(ls) { } +// Floats + +function float(n) { + return n; +} + +function trunc(n) { + return ~~n; +} + +function ceil(n) { + return Math.ceil(n); +} + +function round(n) { + return Math.round(n); +} + + // Time function showTime(tm) { diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index dc4d9ba2..70c1ef55 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -145,6 +145,14 @@ val signal : t ::: Type -> source t -> signal t val current : t ::: Type -> signal t -> transaction t +(** * Floats *) + +val float : int -> float +val ceil : float -> int +val trunc : float -> int +val round : float -> int + + (** * Time *) val now : transaction time |