I am converting a javascript function to java, and don't understand the purpose of the bitwise ors in the code below:
(Math.tan(PHId)) ^ 2)
- is this ensuring the number always ends in 2?(Et ^ 6)
The code is part of a library to convert Irish Grid References to/from Latitude and Longitude: http://www.nearby.org.uk/tests/geotools2.js
GT_Math.E_N_to_Lat = function(East, North, a, b, e0, n0, f0, PHI0, LAM0)
{
//Un-project Transverse Mercator eastings and northings back to latitude.
//Input: - _
//eastings (East) and northings (North) in meters; _
//ellipsoid axis dimensions (a & b) in meters; _
//eastings (e0) and northings (n0) of false origin in meters; _
//central meridian scale factor (f0) and _
//latitude (PHI0) and longitude (LAM0) of false origin in decimal degrees.
//'REQUIRES THE "Marc" AND "InitialLat" FUNCTIONS
//Convert angle measures to radians
var Pi = 3.14159265358979;
var RadPHI0 = PHI0 * (Pi / 180);
var RadLAM0 = LAM0 * (Pi / 180);
//Compute af0, bf0, e squared (e2), n and Et
var af0 = a * f0;
var bf0 = b * f0;
var e2 = (Math.pow(af0,2) - Math.pow(bf0,2)) / Math.pow(af0,2);
var n = (af0 - bf0) / (af0 + bf0);
var Et = East - e0;
//Compute initial value for latitude (PHI) in radians
var PHId = GT_Math.InitialLat(North, n0, af0, RadPHI0, n, bf0);
//Compute nu, rho and eta2 using value for PHId
var nu = af0 / (Math.sqrt(1 - (e2 * ( Math.pow(Math.sin(PHId),2)))));
var rho = (nu * (1 - e2)) / (1 - (e2 * Math.pow(Math.sin(PHId),2)));
var eta2 = (nu / rho) - 1;
//Compute Latitude
var VII = (Math.tan(PHId)) / (2 * rho * nu);
var VIII = ((Math.tan(PHId)) / (24 * rho * Math.pow(nu,3))) * (5 + (3 * (Math.pow(Math.tan(PHId),2))) + eta2 - (9 * eta2 * (Math.pow(Math.tan(PHId),2))));
var IX = ((Math.tan(PHId)) / (720 * rho * Math.pow(nu,5))) * (61 + (90 * ((Math.tan(PHId)) ^ 2)) + (45 * (Math.pow(Math.tan(PHId),4))));
var E_N_to_Lat = (180 / Pi) * (PHId - (Math.pow(Et,2) * VII) + (Math.pow(Et,4) * VIII) - ((Et ^ 6) * IX));
return (E_N_to_Lat);
}