The reason is that Math.PI != π
.
You can try toFixed(15)
to get a precise value.
trace(String(Math.cos(90 * Math.PI / -180).toFixed(15)));
trace(String(Math.sin(180 * Math.PI / -180).toFixed(15)));
trace(String(Math.cos(270 * Math.PI / -180).toFixed(15)));
trace(String(Math.cos(90 * Math.PI / -180).toFixed(15)) == 0);
trace(String(Math.sin(180 * Math.PI / -180).toFixed(15)) == 0);
trace(String(Math.cos(270 * Math.PI / -180).toFixed(15)) == 0);
OutPut.
0.000000000000000
-0.000000000000000
-0.000000000000000
true
true
true