I was optimizing a query by precalculating some trigonometry-funnctions for the fields in a table, when I stumbled on this:
SELECT 6371 * acos( 0.793521289617132 * 0.793521289617132 + 0.608542490648241 * 0.608542490648241 * cos( 0.235244203230056 - 0.235244203230056 ) )
returns null
the query with non-precalculated values:
SELECT 6371 * acos( sin( radians( 52.51581 ) ) * sin( radians( 52.51581 ) ) + cos( radians( 52.51581 ) ) * cos( radians( g.lat ) ) * cos( radians( 13.4785 ) - radians( 13.4785 ) ) )
returns 0 (which is the correct result)
Is this a bug? or is it expected?