Bug #62697 Example for multiplication is not correct
Submitted: 12 Oct 2011 9:46 Modified: 27 Aug 2012 15:55
Reporter: Daniël van Eeden Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5, 5.6.4-m5 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[12 Oct 2011 9:46] Daniël van Eeden
Description:
Example for multiplication is not in line with 5.6 behaviour

http://dev.mysql.com/doc/refman/5.6/en/arithmetic-functions.html#operator_times

How to repeat:
mysql> SELECT 3*5;
+-----+
| 3*5 |
+-----+
|  15 |
+-----+
1 row in set (0.00 sec)

mysql> SELECT 18014398509481984*18014398509481984.0;
+---------------------------------------+
| 18014398509481984*18014398509481984.0 |
+---------------------------------------+
|   324518553658426726783156020576256.0 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT 18014398509481984*18014398509481984;
ERROR 1690 (22003): BIGINT value is out of range in '(18014398509481984 * 18014398509481984)'

Suggested fix:
Update docs.
[12 Oct 2011 9:50] Daniël van Eeden
Results for 'SELECT 18014398509481984*18014398509481984;':
5.0.92: 0
5.2.7-MariaDB: 0
5.3.2-MariaDB-beta: 0
5.5.11: ERROR 1690
5.6.4-m5: ERROR 1690

This seem to indicate that versions up to 5.1 (On which MariaDB is based) will return 0 and 5.5 and newer will return an error.
[12 Oct 2011 13:06] Valeriy Kravchuk
Thank you for the bug report. Manual for version 5.5 (http://dev.mysql.com/doc/refman/5.5/en/arithmetic-functions.html#operator_times) is also incorrect:

macbook-pro:5.5 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.5.17-debug Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  SELECT 18014398509481984*18014398509481984.0;
+---------------------------------------+
| 18014398509481984*18014398509481984.0 |
+---------------------------------------+
|   324518553658426726783156020576256.0 |
+---------------------------------------+
1 row in set (0.03 sec)

mysql> SELECT 18014398509481984*18014398509481984;
ERROR 1690 (22003): BIGINT value is out of range in '(18014398509481984 * 18014398509481984)'
[27 Aug 2012 15:55] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.
[27 Aug 2012 15:57] Paul DuBois
This change in result occurs as of MySQL 5.5.5 when better overflow detection was implemented.

http://dev.mysql.com/doc/refman/5.5/en/out-of-range-and-overflow.html
http://dev.mysql.com/doc/refman/5.5/en/news-5-5-5.html