Bug #62584 PI()+0.000000000000000000 returns differenct value between 5.1 and 5.5.
Submitted: 30 Sep 2011 9:31 Modified: 24 Jan 2012 10:23
Reporter: Meiji KIMURA Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.5.17 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression

[30 Sep 2011 9:31] Meiji KIMURA
Description:
http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html#function_pi
http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_pi

MySQL 5.1 and 5.5's document said about PI() like ....

//->Quate
PI()

Returns the value of π (pi). The default number of decimal places displayed is seven, but MySQL uses the full double-precision value internally.

mysql> SELECT PI();
        -> 3.141593
mysql> SELECT PI()+0.000000000000000000;
        -> 3.141592653589793116
//<-Quate

It's true in MySQL 5.1, but it's not true in 5.5. Last threee digit are '000' instead of '116'.

mysql> SELECT PI()+0.000000000000000000;
+---------------------------+
| PI()+0.000000000000000000 |
+---------------------------+
|      3.141592653589793000 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.13    |
+-----------+
1 row in set (0.00 sec)

How to repeat:
See Description.

Suggested fix:
Return the same value as MySQL 5.1.x, or modify the document of MySQL 5.5.x.
[30 Sep 2011 12:36] Valeriy Kravchuk
Thank you for the problem report. Verified just as described:

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 9
Server version: 5.5.17-debug-log 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 pi();
+----------+
| pi()     |
+----------+
| 3.141593 |
+----------+
1 row in set (0.09 sec)

mysql> select pi()+0.000000000000000000;
+---------------------------+
| pi()+0.000000000000000000 |
+---------------------------+
|      3.141592653589793000 |
+---------------------------+
1 row in set (0.06 sec)
[24 Jan 2012 10:23] Tor Didriksen
5.1 was wrong, 5.5 is correct, it only prints 16 (== DBL_DIG + 1) significant
digits

with 19 digits of precision, the result would be
3.141592653589793238

See also 
"Incompatible Change: The server now includes dtoa, a library for conversion..."
http://dev.mysql.com/doc/refman/5.5/en/news-5-5-3.html