It's rather easy to test on mysql:
32bit overflow:
mysql> select sum(x) from (
select pow(2,31) as x
union all
select pow(2,31)
union all
select pow(2,31)
) as bignums;
+------------+
| sum(x) |
+------------+
| 6442450944 | // returned as a "bigint"
+------------+
1 row in set (0.00 sec)
64bit:
mysql> select sum(x) from (
select pow(2,63) as x
union all
select pow(2,63)
union all
select pow(2,63)
) as bignums;
+-----------------------+
| sum(x) |
+-----------------------+
| 2.7670116110564327e19 | // returned as float
+-----------------------+
1 row in set (0.00 sec)
Double:
mysql> select sum(x) from (
select 1.7e+308 as x
union all
select 1.7e+308
union all
select 1.7e+308
) as bignums;
+--------+
| sum(x) |
+--------+
| 0 |
+--------+
It's rather easy to test on mysql:
32bit overflow:
mysql> select sum(x) from (
select pow(2,31) as x
union all
select pow(2,31)
union all
select pow(2,31)
) as bignums;
+------------+
| sum(x) |
+------------+
| 6442450944 | // returned as a "bigint"
+------------+
1 row in set (0.00 sec)
64bit:
mysql> select sum(x) from (
select pow(2,63) as x
union all
select pow(2,63)
union all
select pow(2,63)
) as bignums;
+-----------------------+
| sum(x) |
+-----------------------+
| 2.7670116110564327e19 | // returned as float
+-----------------------+
1 row in set (0.00 sec)
Double:
mysql> select sum(x) from (
select 1.7e+308 as x
union all
select 1.7e+308
union all
select 1.7e+308
) as bignums;
+--------+
| sum(x) |
+--------+
| 0 |
+--------+
comment followup:
mysql> describe overflow
-> ;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| x | int(11) | YES | | NULL | |
| y | bigint(20) | YES | | NULL | |
| z | double | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> select * from overflow;
+------------+---------------------+---------+
| x | y | z |
+------------+---------------------+---------+
| 2147483647 | 9223372036854775807 | 1.7e308 |
| 2147483647 | 9223372036854775807 | 1.7e308 |
| 2147483647 | 9223372036854775807 | 1.7e308 |
+------------+---------------------+---------+
3 rows in set (0.00 sec)
mysql> select sum(x), sum(y), sum(z) from overflow;
+------------+----------------------+--------+
| sum(x) | sum(y) | sum(z) |
+------------+----------------------+--------+
| 6442450941 | 27670116110564327421 | 0 |
+------------+----------------------+--------+
1 row in set (0.00 sec)