Bug #119292 SIN result is not the same with SIN(x+2*PI())
Submitted: 3 Nov 6:07 Modified: 4 Nov 20:41
Reporter: cl hl Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:9.4.0 OS:Any
Assigned to: CPU Architecture:Any

[3 Nov 6:07] cl hl
Description:
In theory, sin(0)'s result should be the same with sin(0+2*PI()).But they are not .Additionally,they should be the same absolutely.

mysql> SELECT SIN(0);
ELECT SIN(0+2*PI());+--------+
| SIN(0) |
+--------+
|      0 |
+--------+
1 row in set (0.00 sec)

mysql> SELECT SIN(0+2*PI());
+-------------------------+
| SIN(0+2*PI())           |
+-------------------------+
| -2.4492935982947064e-16 |
+-------------------------+
1 row in set (0.00 sec)

How to repeat:
SELECT SIN(0);
SELECT SIN(0+2*PI());
[4 Nov 20:41] Roy Lyseng
Floating point numbers are rarely exact. But 0 is an exact number, so SIN(0) can be exactly zero. 2*PI() on the other hand is not exact, so calculating SIN(2*PI()) must necessarily be an approximation to zero.
Not a bug.