1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-1822 add LONG DOUBLE support

This commit is contained in:
David Hall
2019-01-29 09:55:43 -06:00
parent ee2cb7b0de
commit c5b9ae11e5
40 changed files with 746 additions and 38 deletions

View File

@ -57,6 +57,14 @@ public:
return strtod(getStrVal(row, fp, isNull, op_ct).c_str(), NULL);
}
double getLongDoubleVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
return strtold(getStrVal(row, fp, isNull, op_ct).c_str(), NULL);
}
#if 0
std::string getStrVal(rowgroup::Row& row,
FunctionParm& fp,
@ -105,12 +113,16 @@ protected:
// Bug3788, use the shorter of fixed or scientific notation for floating point values.
// [ the default format in treenode.h is fixed-point notation ]
char buf[20];
double floatVal;
int exponent;
double base;
long double floatVal;
int64_t exponent;
long double base;
switch (fp->data()->resultType().colDataType)
{
case execplan::CalpontSystemCatalog::LONGDOUBLE:
floatVal = fp->data()->getLongDoubleVal(row, isNull);
break;
case execplan::CalpontSystemCatalog::DOUBLE:
floatVal = fp->data()->getDoubleVal(row, isNull);
break;
@ -125,19 +137,19 @@ protected:
break;
}
exponent = (int)floor(log10( fabs(floatVal)));
exponent = (int)floor(log10( fabsl(floatVal)));
base = floatVal * pow(10, -1.0 * exponent);
if (isnan(exponent) || isnan(base))
{
snprintf(buf, 20, "%f", floatVal);
snprintf(buf, 20, "%Lf", floatVal);
fFloatStr = execplan::removeTrailing0(buf, 20);
}
else
{
snprintf(buf, 20, "%.5f", base);
snprintf(buf, 20, "%.5Lf", base);
fFloatStr = execplan::removeTrailing0(buf, 20);
snprintf(buf, 20, "e%02d", exponent);
snprintf(buf, 20, "e%02ld", exponent);
fFloatStr += buf;
}