Title explains my problem.
I’m trying to do some dot calculations for my game, and from my understanding, to do degree comparisons, I need to use math.cos.
I input said degrees to the function in radians: math.cos(math.rad(90))
but for some very particular reason, this doesn’t return 0, but a stupid number like 6.1232.
Inputting pi/2 instead of rad90 also gives the same result.

I’ve checked with other values as well, math.cos(math.rad(60)) returns 0.5 as expected. math.cos(0) works too, returns 1.

Is this a bug? Why does only cos90 return a wrong error, but other values don’t?
Thanks for your help and/or explanation in advance.

It’s just floating point precision error. The value you get (6.12 * 10^ -17) is very close to zero that it might as well be considered 0. This can be approximated to 0.0000000000000000612

Read more about floating point precision error here.