Speedup wide integers (#14859)

This commit is contained in:
Artem Zuikov 2020-09-18 12:51:44 +03:00 committed by GitHub
parent 748fb74de2
commit 0520b05001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 662 additions and 340 deletions

View File

@ -54,8 +54,8 @@ template <size_t Bits, typename Signed>
class integer
{
public:
using base_type = uint8_t;
using signed_base_type = int8_t;
using base_type = uint64_t;
using signed_base_type = int64_t;
// ctors
integer() = default;
@ -127,7 +127,7 @@ private:
friend class std::numeric_limits<integer<Bits, signed>>;
friend class std::numeric_limits<integer<Bits, unsigned>>;
base_type m_arr[_impl::arr_size];
base_type items[_impl::item_count];
};
template <typename T>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,292 @@
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
1 1.0 1.00 1.000000 1.0000000
8 8.0 8.00 8.000000 8.0000000
27 27.0 27.00 27.000000 27.0000000
64 64.0 64.00 64.000000 64.0000000
125 125.0 125.00 125.000000 125.0000000
216 216.0 216.00 216.000000 216.0000000
343 343.0 343.00 343.000000 343.0000000
512 512.0 512.00 512.000000 512.0000000
729 729.0 729.00 729.000000 729.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
-0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
-0 0.0 0.00 0.000000 0.0000000
-1 -1.0 -1.00 -1.000000 -1.0000000
-4 -4.0 -4.00 -4.000000 -4.0000000
-9 -9.0 -9.00 -9.000000 -9.0000000
-16 -16.0 -16.00 -16.000000 -16.0000000
-25 -25.0 -25.00 -25.000000 -25.0000000
-36 -36.0 -36.00 -36.000000 -36.0000000
-49 -49.0 -49.00 -49.000000 -49.0000000
-64 -64.0 -64.00 -64.000000 -64.0000000
-81 -81.0 -81.00 -81.000000 -81.0000000
0 0 0 0
4294967295 4294967295 4294967295 4294967295
8589934588 8589934588 8589934588 8589934588
12884901879 12884901879 12884901879 12884901879
17179869168 17179869168 17179869168 17179869168
21474836455 21474836455 21474836455 21474836455
25769803740 25769803740 25769803740 25769803740
30064771023 30064771023 30064771023 30064771023
34359738304 34359738304 34359738304 34359738304
38654705583 38654705583 38654705583 38654705583
0 0 0 0
18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
18446744073709551612 18446744073709551612 18446744073709551612 18446744073709551612
18446744073709551607 18446744073709551607 18446744073709551607 18446744073709551607
18446744073709551600 18446744073709551600 18446744073709551600 18446744073709551600
18446744073709551591 18446744073709551591 18446744073709551591 18446744073709551591
18446744073709551580 18446744073709551580 18446744073709551580 18446744073709551580
18446744073709551567 18446744073709551567 18446744073709551567 18446744073709551567
18446744073709551552 18446744073709551552 18446744073709551552 18446744073709551552
18446744073709551535 18446744073709551535 18446744073709551535 18446744073709551535
0 0 0 0
115792089237316195423570985008687907853269984665640564039457584007913129639935 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
115792089237316195423570985008687907853269984665640564039457584007913129639932 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
115792089237316195423570985008687907853269984665640564039457584007913129639927 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
115792089237316195423570985008687907853269984665640564039457584007913129639920 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
115792089237316195423570985008687907853269984665640564039457584007913129639911 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
115792089237316195423570985008687907853269984665640564039457584007913129639900 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
115792089237316195423570985008687907853269984665640564039457584007913129639887 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
115792089237316195423570985008687907853269984665640564039457584007913129639872 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
115792089237316195423570985008687907853269984665640564039457584007913129639855 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
-1 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
-4 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
-9 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
-16 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
-25 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
-36 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
-49 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
-64 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
-81 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
-1 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
-4 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
-9 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
-16 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
-25 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
-36 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
-49 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
-64 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
-81 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
-1 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
-4 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
-9 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
-16 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
-25 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
-36 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
-49 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
-64 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
-81 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
-1 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
-4 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
-9 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
-16 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
-25 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
-36 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
-49 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
-64 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
-81 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
-1 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
-4 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
-9 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
-16 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
-25 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
-36 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
-49 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
-64 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
-81 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
-1 -1 -1 115792089237316195423570985008687907853269984665640564039457584007913129639935
-4 -4 -4 115792089237316195423570985008687907853269984665640564039457584007913129639932
-9 -9 -9 115792089237316195423570985008687907853269984665640564039457584007913129639927
-16 -16 -16 115792089237316195423570985008687907853269984665640564039457584007913129639920
-25 -25 -25 115792089237316195423570985008687907853269984665640564039457584007913129639911
-36 -36 -36 115792089237316195423570985008687907853269984665640564039457584007913129639900
-49 -49 -49 115792089237316195423570985008687907853269984665640564039457584007913129639887
-64 -64 -64 115792089237316195423570985008687907853269984665640564039457584007913129639872
-81 -81 -81 115792089237316195423570985008687907853269984665640564039457584007913129639855
0 0 0 0
1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0
6 0 0 0
7 0 0 0
8 0 0 0
9 0 0 0
0 0 0 0
-1 0 0 0
-2 0 0 0
-3 0 0 0
-4 0 0 0
-5 0 0 0
-6 0 0 0
-7 0 0 0
-8 0 0 0
-9 0 0 0
2499500025000000 2499500025000000 2499500025000000 2499500025000000.00
0 0 0 0.00

View File

@ -0,0 +1,48 @@
SELECT toUInt32(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt64(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt256(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt32(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt64(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt128(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt256(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toFloat32(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toFloat64(number * number) * number y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt32(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt64(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt256(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt32(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt64(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt128(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toInt256(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toFloat32(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toFloat64(number * number) * -1 y, toDecimal32(y, 1), toDecimal64(y, 2), toDecimal128(y, 6), toDecimal256(y, 7) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt32(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt64(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toUInt256(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toInt32(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toInt64(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toInt128(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toInt256(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toFloat32(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT toFloat64(number * -1) * number y, toInt128(y), toInt256(y), toUInt256(y) FROM numbers_mt(10) ORDER BY number;
SELECT number y, toInt128(number) - y, toInt256(number) - y, toUInt256(number) - y FROM numbers_mt(10) ORDER BY number;
SELECT -number y, toInt128(number) + y, toInt256(number) + y, toUInt256(number) + y FROM numbers_mt(10) ORDER BY number;
SET allow_experimental_bigint_types = 1;
DROP TABLE IF EXISTS t;
CREATE TABLE t (x UInt64, i256 Int256, u256 UInt256, d256 Decimal256(2)) ENGINE = Memory;
INSERT INTO t SELECT number * number * number AS x, x AS i256, x AS u256, x AS d256 FROM numbers(10000);
SELECT sum(x), sum(i256), sum(u256), sum(d256) FROM t;
INSERT INTO t SELECT -number * number * number AS x, x AS i256, x AS u256, x AS d256 FROM numbers(10000);
SELECT sum(x), sum(i256), sum(u256), sum(d256) FROM t;
DROP TABLE t;