An invalid floating point operation occurred
sql-server-2008
Solution
Your result in `ACOS()` is bigger than `1` which can't be.
That is because of floating point inaccuracy. it could be `1.00000001` for instance. Putting it just a little below `1` works like this:
SELECT ACOS(
(SIN(PI()* 52.9519918465976/180.0)* SIN(PI()* 52.9519918465976/180.0))
+ (COS(PI()* 52.9519918465976/180)*cos(PI()* 52.9519918465976/180.0)*COS(PI()* -1.14304013581239/180.0-PI()* -1.14304013581239/180.0))
- 0.0000001
)
Problem
I have a problem with an SQL query and i've narrowed it down to the following code ``` SELECT ACOS( (SIN(PI()* 52.9519918465976/180)*SIN(PI()* 52.9519918465976/180))+(COS(PI()* 52.9519918465976/180)*cos(PI()* 52.9519918465976/180)*COS(PI()* -1.14304013581239/180-PI()* -1.14304013581239/180))) AS test ``` I get the following error message 'An invalid floating point operation occurred' Can abody see what the issue is? Thanks in advance