Why does Spotlight give a wrong value for `cos(pi/2)`? As you might know, Spotlight can do simple mathematics.
For instance, typing cos(pi) will result in -1, as you might expect.
I just typed in cos(pi/2), which should be 0 but it gave me -5e-12.

Yes it is probably due to a rounding error, but come on: cos(pi/2)! 
In my opinion, that clearly looks like bug. What do you think?
It's due to the lack of precision of pi and due to the overall all lack of precision in the built-in system. 

pi = 3.1415926536

pi/2 = 1.5707963268 

cos(1.5707963268) = -5.103412e-12

FYI =  5.103412e-12 = 0.000000000005103412 ~ 0 




About the overall system precision : 

3.141592653589793238462643383 = 3.1415926536 


In Python we get following : 

&gt;&gt;&gt; float("3.141592653589793238462643383")
3.141592653589793


As we can see there is a problem with the precision since it doesn't even match the float representation.