Hello

Attached is a modified version for patch 130-export-smallfloat

Basically, it's ok to use "%e" instead of "%f" but we must NOT call 
trim_trailing_zeros after that.
Or 0.00000000000000e+00 becomes 0.00000000000000e+ that is invalid.


http://nirgal.com/mdbtools
(squeeze version not updated yet)
Description: mdb-export fails exporting small (1e-7) floats, due to a %f used
 instead of a %e.
Author: Vincent Fourmond <fourm...@clipper.ens.fr>
Bug-Debian: http://bugs.debian.org/220403
Last-Update: 2010-08-02

Index: mdbtools-0.6pre1/src/libmdb/data.c
===================================================================
--- mdbtools-0.6pre1.orig/src/libmdb/data.c
+++ mdbtools-0.6pre1/src/libmdb/data.c
@@ -704,6 +704,7 @@
 	return text;
 }
 
+#if 0
 static int trim_trailing_zeros(char * buff)
 {
 	char *p;
@@ -724,6 +725,7 @@
 
 	return 0;
 }
+#endif
 
 /* Date/Time is stored as a double, where the whole
    part is the days from 12/30/1899 and the fractional
@@ -837,15 +839,13 @@
 		break;
 		case MDB_FLOAT:
 			tf = mdb_get_single(buf, start);
-			text = g_strdup_printf("%.*f",
+			text = g_strdup_printf("%.*e",
 				FLT_DIG - floor_log10(tf,1) - 1, tf);
-			trim_trailing_zeros(text);
 		break;
 		case MDB_DOUBLE:
 			td = mdb_get_double(buf, start);
-			text = g_strdup_printf("%.*f",
+			text = g_strdup_printf("%.*e",
 				DBL_DIG - floor_log10(td,0) - 1, td);
-			trim_trailing_zeros(text);
 		break;
 		case MDB_TEXT:
 			if (size<0) {

Reply via email to