<HTML>
<HEAD>
</HEAD>
<BODY>
<SCRIPT>
// Add the cosh function to the Math object
function cosh(aValue)
{
var myTerm1 = Math.pow(Math.E, aValue);
var myTerm2 = Math.pow(Math.E, -aValue);
return (myTerm1+myTerm2)/2;
}
// Register the new function
Math.constructor.prototype.cosh = cosh;
// Test the Math.cosh() method
document.write(Math.cosh(2))
document.write("<BR>")
</SCRIPT>
</BODY>
</HTML>| Prev | Home | Next |
| Math.cosec() | Up | Math.cot() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||