mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fix intDiv of const divider
This commit is contained in:
parent
1803656b9f
commit
ba35ba01cf
@ -33,7 +33,7 @@ struct DivideIntegralByConstantImpl
|
||||
{
|
||||
size_t size = a.size();
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = -c[i];
|
||||
c[i] = -a[i];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,3 +21,63 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
-4
|
||||
-5
|
||||
-6
|
||||
-7
|
||||
-8
|
||||
-9
|
||||
-10
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
-4
|
||||
-5
|
||||
-6
|
||||
-7
|
||||
-8
|
||||
-9
|
||||
-10
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
-4
|
||||
-5
|
||||
-6
|
||||
-7
|
||||
-8
|
||||
-9
|
||||
-10
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
-4
|
||||
-5
|
||||
-6
|
||||
-7
|
||||
-8
|
||||
-9
|
||||
-10
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
|
@ -17,3 +17,9 @@ SELECT intDivOrZero( CAST(-1000, 'Int64') , CAST(1000, 'Int64') );
|
||||
|
||||
SELECT intDiv(-1, number) FROM numbers(1, 10);
|
||||
SELECT intDivOrZero(-1, number) FROM numbers(1, 10);
|
||||
SELECT intDiv(toInt32(number), -1) FROM numbers(1, 10);
|
||||
SELECT intDivOrZero(toInt32(number), -1) FROM numbers(1, 10);
|
||||
SELECT intDiv(toInt64(number), -1) FROM numbers(1, 10);
|
||||
SELECT intDivOrZero(toInt64(number), -1) FROM numbers(1, 10);
|
||||
SELECT intDiv(number, -number) FROM numbers(1, 10);
|
||||
SELECT intDivOrZero(number, -number) FROM numbers(1, 10);
|
||||
|
Loading…
Reference in New Issue
Block a user