diff src/c/urweb.c @ 1920:2f33d9a51765

Increase precision for rendering floats to SQL
author Adam Chlipala <adam@chlipala.net>
date Tue, 03 Dec 2013 16:54:04 -0500
parents f5d1037effc9
children 1a04b1edded2 1e360ea06a09
line wrap: on
line diff
--- a/src/c/urweb.c	Sun Dec 01 16:28:02 2013 -0500
+++ b/src/c/urweb.c	Tue Dec 03 16:54:04 2013 -0500
@@ -1622,7 +1622,7 @@
   int len;
   uw_check_heap(ctx, FLOATS_MAX);
   result = ctx->heap.front;
-  sprintf(result, "%g%n", n, &len);
+  sprintf(result, "%.16g%n", n, &len);
   ctx->heap.front += len+1;
   return result;
 }
@@ -2406,7 +2406,7 @@
     return uw_Basis_sqlifyInt(ctx, *n);
 }
 
-char *uw_sqlfmtFloat = "%g::float8%n";
+char *uw_sqlfmtFloat = "%.16g::float8%n";
 
 char *uw_Basis_sqlifyFloat(uw_context ctx, uw_Basis_float n) {
   int len;