summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Karen Sargsyan <karsar@ibms.sinica.edu.tw>2016-05-21 18:00:59 +0800
committerGravatar Karen Sargsyan <karsar@ibms.sinica.edu.tw>2016-05-21 18:00:59 +0800
commit22527df1714c83e968913dabba4ba3ec81adc20c (patch)
tree9dafbbb36b0d25200b70a92e1aca8f6f0ae2f583 /lib
parent02724f709fcafa9f4e854c271df6c2f79fd9cfa6 (diff)
Some basic math functions: pow, sqrt, sin, cos, log, exp are added to work at client and server sides
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js18
-rw-r--r--lib/ur/basis.urs7
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 410a0e23..7842775b 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -116,7 +116,25 @@ function pow(n, m) {
return Math.pow(n, m);
}
+function sqrt(n){
+ return Math.sqrt(n);
+}
+
+function sin(n){
+ return Math.sin(n);
+}
+
+function cos(n){
+ return Math.cos(n);
+}
+
+function log(n){
+ return Math.log(n);
+}
+function exp(n){
+ return Math.exp(n);
+}
// Time, represented as counts of microseconds since the epoch
var time_format = "%c";
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 883cc5b1..45a17eb1 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -153,6 +153,13 @@ val ceil : float -> int
val trunc : float -> int
val round : float -> int
+(** * Basic Math *)
+
+val sqrt : float -> float
+val sin : float -> float
+val cos : float -> float
+val log : float -> float
+val exp : float -> float
(** * Time *)