Do computations in Float32 (not Float64) for arrays of Float32

This commit is contained in:
Alexander Gololobov 2022-07-03 10:33:11 +02:00
parent ca2829188d
commit 8ce8158f7f
4 changed files with 20 additions and 12 deletions

View File

@ -228,11 +228,12 @@ public:
case TypeIndex::Int8:
case TypeIndex::Int16:
case TypeIndex::Int32:
case TypeIndex::Float32:
case TypeIndex::UInt64:
case TypeIndex::Int64:
case TypeIndex::Float64:
return std::make_shared<DataTypeFloat64>();
case TypeIndex::Float32:
return std::make_shared<DataTypeFloat32>();
default:
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
@ -247,6 +248,9 @@ public:
{
switch (result_type->getTypeId())
{
case TypeIndex::Float32:
return executeWithResultType<Float32>(arguments, input_rows_count);
break;
case TypeIndex::Float64:
return executeWithResultType<Float64>(arguments, input_rows_count);
break;

View File

@ -162,11 +162,12 @@ public:
case TypeIndex::Int8:
case TypeIndex::Int16:
case TypeIndex::Int32:
case TypeIndex::Float32:
case TypeIndex::UInt64:
case TypeIndex::Int64:
case TypeIndex::Float64:
return std::make_shared<DataTypeFloat64>();
case TypeIndex::Float32:
return std::make_shared<DataTypeFloat32>();
default:
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
@ -185,6 +186,9 @@ public:
switch (result_type->getTypeId())
{
case TypeIndex::Float32:
return executeWithResultType<Float32>(*arr, type, input_rows_count, arguments);
break;
case TypeIndex::Float64:
return executeWithResultType<Float64>(*arr, type, input_rows_count, arguments);
break;

View File

@ -45,16 +45,16 @@ nan
6 5 268 2 9.70940985211151 23.15167380558045 536 0.00007815428961455151
6 6 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 2 2031 788 992.2102104083964 1182.129011571918 1397429 0.1939823640079572
2 1 2031 788 992.2102104083964 1182.129011571918 1397429 0.1939823640079572
1 2 2031 788 992.2102 1182.129 1397429 0.19398236
2 1 2031 788 992.2102 1182.129 1397429 0.19398236
2 2 0 0 0 0 0 0
3 3 0 0 0 0 0 0
3 4 68 2 6.479223602554966 11.661903789690601 136 0.0010041996325123037
4 3 68 2 6.479223602554966 11.661903789690601 136 0.0010041996325123037
3 4 68 2 6.4792237 11.661903 136 0.0010041595
4 3 68 2 6.4792237 11.661903 136 0.0010041595
4 4 0 0 0 0 0 0
5 5 0 0 0 0 0 0
5 6 268 2 10.234459893824097 23.15167380558045 536 0.00007815428961455151
6 5 268 2 10.234459893824097 23.15167380558045 536 0.00007815428961455151
5 6 268 2 10.23446 23.151674 536 0.00007814169
6 5 268 2 10.23446 23.151674 536 0.00007814169
6 6 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 2 2031 788 992.2102104083964 1182.129011571918 1397429 0.1939823640079572

View File

@ -16,12 +16,12 @@
4 11
5 11
6 11
1 7 5 25 4.601724723020627 4
1 7 5 25 4.6017246 4
2 2 2 4 2 2
3 9 5.196152422706632 27 4.506432087111623 3
3 9 5.196152 27 4.506432 3
4 0 0 0 0 0
5 330 78.16648898345122 6110 54.82161001608108 26
6 5250 599.12436104702 358950 350.73959029428204 102
5 330 78.16649 6110 54.82161 26
6 5250 599.1244 358950 350.7396 102
1 11
2 11
3 11