1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge pull request #13 from mariadb-corporation/MCOL-290

Mcol 290
This commit is contained in:
Andrew Hutchings
2016-09-23 09:24:13 -05:00
committed by GitHub
5 changed files with 563 additions and 471 deletions

View File

@ -39,7 +39,6 @@
#include "calpontsystemcatalog.h"
#include "exceptclasses.h"
#include "dataconvert.h"
namespace messageqcpp {
class ByteStream;
}
@ -483,8 +482,24 @@ inline const std::string& TreeNode::getStrVal()
}
else
{
snprintf(tmp, 312, "%e", fResult.floatVal);
fResult.strVal = tmp;
// MCOL-299 Print scientific with 5 mantissa and no + sign for exponent
int exponent = (int)floor(log10( fabs(fResult.floatVal))); // This will round down the exponent
double base = fResult.floatVal * pow(10, -1.0*exponent);
if (isnan(exponent) || isnan(base))
{
snprintf(tmp, 312, "%f", fResult.floatVal);
fResult.strVal = removeTrailing0(tmp, 312);
}
else
{
snprintf(tmp, 312, "%.5f", base);
fResult.strVal = removeTrailing0(tmp, 312);
snprintf(tmp, 312, "e%02d", exponent);
fResult.strVal += tmp;
}
// snprintf(tmp, 312, "%e.5", fResult.floatVal);
// fResult.strVal = tmp;
}
break;
}
@ -499,8 +514,23 @@ inline const std::string& TreeNode::getStrVal()
}
else
{
snprintf(tmp, 312, "%e", fResult.doubleVal);
fResult.strVal = tmp;
// MCOL-299 Print scientific with 9 mantissa and no + sign for exponent
int exponent = (int)floor(log10( fabs(fResult.doubleVal))); // This will round down the exponent
double base = fResult.doubleVal * pow(10, -1.0*exponent);
if (isnan(exponent) || isnan(base))
{
snprintf(tmp, 312, "%f", fResult.doubleVal);
fResult.strVal = removeTrailing0(tmp, 312);
}
else
{
snprintf(tmp, 312, "%.9f", base);
fResult.strVal = removeTrailing0(tmp, 312);
snprintf(tmp, 312, "e%02d", exponent);
fResult.strVal += tmp;
}
// snprintf(tmp, 312, "%e", fResult.doubleVal);
// fResult.strVal = tmp;
}
break;
}