0 votes
115 views asked Mar 5, 2020 by Carlos | 115 views

2 Answers

0 votes
Hi Carlos,

thank you for your question.  Taking a look at this now.

When I remove the acos() it is returning a result, will keep looking.
answered Mar 5, 2020 by ascottdemo (1,280 points)
Hi Carlos,

a little more digging and you got "lucky" to run across a number that looks like 1 but is actually a little more than 1.  We use double precision numbers that can be inexact (https://www.postgresql.org/docs/11/datatype-numeric.html) due to the nature of floating point numbers.
Try this query
SELECT acos( sin( (des_sva1.gold_catalog.dec_j2000)*3.14159/180) *
       sin(((-43.147769))*3.14159/180) +
       cos( (des_sva1.gold_catalog.dec_j2000)*3.14159/180) *
       cos(((-43.147769))*3.14159/180) *
       cos((des_sva1.gold_catalog.ra_j2000-(6.928423))*3.14159/180) - 0.0000000000001 )
 as pdis FROM des_sva1.gold_catalog WHERE des_sva1.gold_catalog.ra_j2000 BETWEEN 6.9270341111111 AND 6.9298118888889 AND des_sva1.gold_catalog.dec_j2000 BETWEEN -43.149157888889 AND -43.146380111111 ;
0 votes
Thanks for your answer.

Actually this is a useful trick. I am going to use it.

Thanks again :)
answered Mar 5, 2020 by Carlos

252 questions

254 answers

290 comments

1,716 users

Welcome to Data Lab Help Desk, where you can ask questions and receive answers from other members of the community.