Fix round function error code

This commit is contained in:
alesapin 2020-03-12 12:26:54 +03:00
parent b4cf1410ed
commit eb656c2a65
2 changed files with 4 additions and 2 deletions

View File

@ -394,8 +394,8 @@ public:
case 1000000000000000000ULL: return applyImpl<1000000000000000000ULL>(in, out); case 1000000000000000000ULL: return applyImpl<1000000000000000000ULL>(in, out);
case 10000000000000000000ULL: return applyImpl<10000000000000000000ULL>(in, out); case 10000000000000000000ULL: return applyImpl<10000000000000000000ULL>(in, out);
default: default:
throw Exception("Logical error: unexpected 'scale' parameter passed to function IntegerRoundingComputation::compute", throw Exception("Unexpected 'scale' parameter passed to function",
ErrorCodes::LOGICAL_ERROR); ErrorCodes::BAD_ARGUMENTS);
} }
} }
}; };

View File

@ -43,3 +43,5 @@ SELECT 12345.6789 AS x, floor(x, -1), floor(x, -2), floor(x, -3), floor(x, -4),
SELECT roundToExp2(100), roundToExp2(64), roundToExp2(3), roundToExp2(0), roundToExp2(-1); SELECT roundToExp2(100), roundToExp2(64), roundToExp2(3), roundToExp2(0), roundToExp2(-1);
SELECT roundToExp2(0.9), roundToExp2(0), roundToExp2(-0.5), roundToExp2(-0.6), roundToExp2(-0.2); SELECT roundToExp2(0.9), roundToExp2(0), roundToExp2(-0.5), roundToExp2(-0.6), roundToExp2(-0.2);
SELECT ceil(29375422, -54212) --{serverError 36}