Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

does anyone know trig?

Status
Not open for further replies.

zishan876

Programmer
Mar 19, 2007
61
US
hi all:
I have the following statement:
Code:
select SF_Name,latitude,longitude, Math.acos(Math.SIN(Math.PI()* 40.7383040 /180 )*Math.SIN( Math.PI()*latitude/180 )
)+(Math.cos(Math.PI()* 40.7383040 /180)*Math.COS( Math.PI()*latitude/180) *Math.COS(Math.PI()*longitude/180-Math.PI()* -73.99319 /180)
)* 3963.191 AS distance
FROM SF_Locations
WHERE 1=1
AND 3963.191 * Math.ACOS( (Math.SIN(Math.PI()* 40.7383040 /180)*Math.SIN(Math.PI() * latitude/180)) +
(Math.COS(Math.PI()* 40.7383040 /180)*Math.cos(Math.PI()*latitude/180)*Math.COS(Math.PI() * longitude/180-Math.PI()* -73.99319 /180))
) < = 1.5
ORDER BY 3963.191 * ACOS(
(Math.SIN(Math.PI()* 40.7383040 /180)*SIN(PI()*latitude/180)) +
(Math.COS(Math.PI()* 40.7383040 /180)*Math.cos(Math.PI()*latitude/180)*Math.COS(Math.PI() * longitude/180-Math.PI()* -73.99319 /180))
I wanted to know does anyone know how to put this statement in javascript...
I have having a hard time...
 
Which bit do you want in JS? Do you want to select rows from a DB in JS, or just do some Maths?

If the latter, then most of the "Math." statements you have should work, but you'll need to use "Math.sin" instead of "SIN", "Math.cos" instead of "COS", etc.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top