Mercurial > urweb
comparison lib/js/urweb.js @ 1571:f403e129c276
Primitive int/float functions: ceil, float, round, trunc
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 08 Oct 2011 17:23:58 -0400 |
parents | df6a7a22760a |
children | e283ca05c829 |
comparison
equal
deleted
inserted
replaced
1570:c7d0328ba777 | 1571:f403e129c276 |
---|---|
88 | 88 |
89 for (; ls; ls = ls.next) | 89 for (; ls; ls = ls.next) |
90 ++acc; | 90 ++acc; |
91 | 91 |
92 return acc; | 92 return acc; |
93 } | |
94 | |
95 | |
96 // Floats | |
97 | |
98 function float(n) { | |
99 return n; | |
100 } | |
101 | |
102 function trunc(n) { | |
103 return ~~n; | |
104 } | |
105 | |
106 function ceil(n) { | |
107 return Math.ceil(n); | |
108 } | |
109 | |
110 function round(n) { | |
111 return Math.round(n); | |
93 } | 112 } |
94 | 113 |
95 | 114 |
96 // Time | 115 // Time |
97 | 116 |