Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
[java] How can I rewrite this math formula to work in my program?
Author Summary
cptn_jtk is in Java
Post Body

dlon = x2 - x1; dlat = y2 - y1; a = (Math.sin(dlat/2))2 Math.cos(lat1) * Math.cos(lat2) * (Math.sin(dlon/2))2; c = 2 * (aMath.tan(2)(Math.sqrt(a), Math.sqrt(1-a))); result = r * c;

I am writing a program to calculate the distance between two places in the world based on their longitude(x) and latitude(y). there is a formula for doing this and i am almost sucessful in rewriting it to work in java but i hit a bit of a problem. the comma in the second last line, im not sure how to rewrite this. any help would be great. if you need any extra info to solve this just ask.

I forgot to mention that r is the radius of the earth in km (6371)

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,125
Link Karma
3,675
Comment Karma
2,404
Profile updated: 5 days ago
Posts updated: 7 months ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
11 years ago