diff src/c/urweb.c @ 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 e1f5d9c4cc20
children 43f22a8f76cc
line wrap: on
line diff
--- a/src/c/urweb.c	Sat Oct 08 14:16:13 2011 -0400
+++ b/src/c/urweb.c	Sat Oct 08 17:23:58 2011 -0400
@@ -16,6 +16,7 @@
 #include <openssl/des.h>
 #include <openssl/rand.h>
 #include <time.h>
+#include <math.h>
 
 #include <pthread.h>
 
@@ -3956,3 +3957,19 @@
 uw_Basis_string uw_Basis_fresh(uw_context ctx) {
   return uw_Basis_htmlifyInt(ctx, ctx->nextId++);
 }
+
+uw_Basis_float uw_Basis_floatFromInt(uw_context ctx, uw_Basis_int n) {
+  return n;
+}
+
+uw_Basis_int uw_Basis_ceil(uw_context ctx, uw_Basis_float n) {
+  return ceil(n);
+}
+
+uw_Basis_int uw_Basis_trunc(uw_context ctx, uw_Basis_float n) {
+  return trunc(n);
+}
+
+uw_Basis_int uw_Basis_round(uw_context ctx, uw_Basis_float n) {
+  return round(n);
+}