Bug #69916 COT() does not behave as expected
Submitted: 3 Aug 2013 10:10 Modified: 13 Jan 2015 14:39
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.5+ OS:Any
Assigned to: CPU Architecture:Any

[3 Aug 2013 10:10] Peter Laursen
Description:
This bug report originally appeared on a MariaDB mailing list. Both (Oracle) MySQL and MariaDB 5.5+ are affected.

Documentation for all versions
http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_cot
http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html#function_cot
http://dev.mysql.com/doc/refman/5.6/en/mathematical-functions.html#function_cot
http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_cot

.. states that "SELECT COT(0)" should return NULL.  It does in 5.1, but in 5.5 and higher you get the error "ERROR 1690 (22003): DOUBLE value is out of range in 'cot(0)'"

How to repeat:
SELECT COT(0);

Suggested fix:
I don't think that COT() is a much-used function in MySQL. But anyway the (undocumented) change in behavior may break legacy scripts and applications and the documented behavior should be restored to 5.5+ servers.
[3 Aug 2013 11:54] Umesh Shastry
Hello Peter,

Thank you for the bug report. 
Verified as described.

Thanks,
Umesh
[4 Aug 2013 16:14] Shane Bester
I've already caught this and filed it internally in 2012.

Bug 12878196 - COT (0) GIVES ERROR AND 1/TAN(0) GIVES NULL + WARNING ?

Another external bug:
http://bugs.mysql.com/bug.php?id=65295
[13 Jan 2015 14:39] Stefan Hinz
Closed by mistake, sorry. Reopened. -Stefan