Issue #33 inconsistency for float rounding

This commit is contained in:
Henry Rawas
2013-01-30 11:27:16 -08:00
parent 614845c668
commit 60e84f255c
5 changed files with 5 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5
View File
@@ -81,7 +81,12 @@ robj *createStringObjectFromLongDouble(long double value) {
* that is "non surprising" for the user (that is, most small decimal
* numbers will be represented in a way that when converted back into
* a string are exactly the same as what the user typed.) */
#ifdef _WIN32
/* on Windows the magic number is 15 */
len = snprintf(buf,sizeof(buf),"%.15Lf", value);
#else
len = snprintf(buf,sizeof(buf),"%.17Lf", value);
#endif
/* Now remove trailing zeroes after the '.' */
if (strchr(buf,'.') != NULL) {
char *p = buf+len-1;