From 5c7e4216fad75c8bc2f92cdf48ed77c4621c0773 Mon Sep 17 00:00:00 2001 From: Brian Bruns Date: Mon, 7 Feb 2011 22:04:30 -0500 Subject: [PATCH] =?UTF-8?q?clean=20up=20float=20length,=20from=20Nirgal=20?= =?UTF-8?q?Vourg=C3=A8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libmdb/data.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libmdb/data.c b/src/libmdb/data.c index 568443d..f431c92 100644 --- a/src/libmdb/data.c +++ b/src/libmdb/data.c @@ -19,7 +19,6 @@ #include "mdbtools.h" #include "time.h" -#include "math.h" #ifdef DMALLOC #include "dmalloc.h" @@ -803,6 +802,7 @@ mdb_date_to_string(MdbHandle *mdb, int start) return text; } +#if 0 int floor_log10(double f, int is_single) { unsigned int i; @@ -831,6 +831,7 @@ int floor_log10(double f, int is_single) return (int)i; } } +#endif char *mdb_col_to_string(MdbHandle *mdb, void *buf, int start, int datatype, int size) { @@ -856,13 +857,11 @@ char *mdb_col_to_string(MdbHandle *mdb, void *buf, int start, int datatype, int break; case MDB_FLOAT: tf = mdb_get_single(buf, start); - text = g_strdup_printf("%.*e", - FLT_DIG - floor_log10(tf,1) - 1, tf); + text = g_strdup_printf("%.8e", tf); break; case MDB_DOUBLE: td = mdb_get_double(buf, start); - text = g_strdup_printf("%.*e", - DBL_DIG - floor_log10(td,0) - 1, td); + text = g_strdup_printf("%.16e", td); break; case MDB_BINARY: case MDB_TEXT: