If I'm not mistaken Math.tan(x) does not take aangles as degrees, but rather radians.
If you want to supply angles as degrees, try the following code sample:
function getTanDeg(deg) {
var rad = deg * Math.PI/180;
return Math.tan(rad);
}
HereSource - Mozilla Developer Network is the documentation.