How to use code for cos^-1

i want to use cos^-1 for calculation, how do i code for that?

float distance = (acos(cos(radians(90-latitude))*cos(radians(90-previouslatitude))+sin(radians(90-latitude))*sin(radians(90-previouslatitude))*cos(radians(longitude-previouslongitude)))*6371)*1000;

i want to calculate distance in meter, is it above code is correct?

is it radians and acos can be use like that , what is acos?

acos is the arc cosine or arccos
The argument is a number between -1 and +1

i see, so is it correct i can use like that on my code, for radians part?

The beauty of Arduino is that in a couple of minutes, you can try the code and see what happens when it runs!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.