mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-06-28 15:39:02 +08:00
clean up float length, from Nirgal Vourgère
This commit is contained in:
parent
be2a287f5c
commit
5c7e4216fa
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "math.h"
|
|
||||||
|
|
||||||
#ifdef DMALLOC
|
#ifdef DMALLOC
|
||||||
#include "dmalloc.h"
|
#include "dmalloc.h"
|
||||||
@ -803,6 +802,7 @@ mdb_date_to_string(MdbHandle *mdb, int start)
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
int floor_log10(double f, int is_single)
|
int floor_log10(double f, int is_single)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -831,6 +831,7 @@ int floor_log10(double f, int is_single)
|
|||||||
return (int)i;
|
return (int)i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
char *mdb_col_to_string(MdbHandle *mdb, void *buf, int start, int datatype, int size)
|
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;
|
break;
|
||||||
case MDB_FLOAT:
|
case MDB_FLOAT:
|
||||||
tf = mdb_get_single(buf, start);
|
tf = mdb_get_single(buf, start);
|
||||||
text = g_strdup_printf("%.*e",
|
text = g_strdup_printf("%.8e", tf);
|
||||||
FLT_DIG - floor_log10(tf,1) - 1, tf);
|
|
||||||
break;
|
break;
|
||||||
case MDB_DOUBLE:
|
case MDB_DOUBLE:
|
||||||
td = mdb_get_double(buf, start);
|
td = mdb_get_double(buf, start);
|
||||||
text = g_strdup_printf("%.*e",
|
text = g_strdup_printf("%.16e", td);
|
||||||
DBL_DIG - floor_log10(td,0) - 1, td);
|
|
||||||
break;
|
break;
|
||||||
case MDB_BINARY:
|
case MDB_BINARY:
|
||||||
case MDB_TEXT:
|
case MDB_TEXT:
|
||||||
|
Loading…
Reference in New Issue
Block a user