<script language="JavaScript"> // 30度正切 document.write( Math.tan(30*2*Math.PI/360) + "<br />" ); // 45度正切 document.write( Math.tan(45*2*Math.PI/360) + "<br />" ); document.write( Math.tan(0.5) + "<br />" ); document.write( Math.tan(-10) ); </script>
运行该例子,输出:
0.5773502691896257 0.9999999999999999 0.5463024898437905 -0.6483608274590866