Bug #43926 Function COS error at PI/2
Submitted: 27 Mar 2009 22:13 Modified: 28 Mar 2009 15:34
Reporter: Shawn Reeves Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.75 OS:Any
Assigned to: CPU Architecture:Any
Tags: functions, numeric function

[27 Mar 2009 22:13] Shawn Reeves
Description:
The function COS() returns an invalid answer when given PI/2 (90 degrees), not the expected zero. The number is also greater than 1; COS should never return a number greater than 1 or less than -1. COS returns an invalid answer for any angle between 1.5707 and 1.5708. Note that SELECT PI()/2 yields the correct 1.5707963268.

How to repeat:
SELECT PI()/2, COS(PI()/2), COS(RADIANS(90)), COS(1.5707)

Suggested fix:
Revisit trigonometry engine.
[27 Mar 2009 22:39] Shawn Reeves
Appears also in 5.0.24a. Can someone please check this in 5.1?
[28 Mar 2009 0:28] MySQL Verification Team
Thank you for the bug report. Could you please print here the output you got and the specific OS you had run the query. Thanks in advance.
[28 Mar 2009 15:34] Shawn Reeves
mantissa only shown, client truncating power of 10. Not a bug