next up previous
Next: Datumsbehandlung - date Up: Datentyp-Behandlung Previous: Zeichenketten - string

Mathematische Grundfunktionen - math

Beispiel:
<BODY><SCRPT>
a = 3.4;
document.write("<h4><tt>Math</tt>-Demo</h4>")
document.write("Rundungen (<b> a = ",a,"</b>):<br>")
document.write("round(a)   = <b>",Math.round(a),"</b><br>")
document.write("floor(a)   = <b>",Math.floor(a),"</b><br>")
document.write("ceil(a)    = <b>",Math.ceil(a),"</b><br>")
document.write("round(-a)  = <b>",Math.round(-a),"</b><br>")
document.write("floor(-a)  = <b>",Math.floor(-a),"</b><br>")
document.write("ceil(-a)   = <b>",Math.ceil(-a),"</b><p>")

document.writeln("abs(-4)  = ",Math.abs(-4),"<br>")
document.writeln("exp(2)   = ",Math.exp(2),"<br>")
document.writeln("log(10   = ",Math.log(10),"<br>")
document.writeln("pow(2,8) = ",Math.pow(2,8),"<br>")
document.writeln("sqrt(25) = ",Math.sqrt(25),"<br>")

document.writeln("<p>Mathematische Konstanten:<p>")
document.writeln("E = ",Math.E,"<br>LN2 = ",Math.LN2)
document.writeln("<br>LN10 = ",Math.LN10,"<br>LOG2E = ",
Math.LOG2E,"<br>")
document.writeln("LOG10E = ",Math.LOG10E,"<br>PI = ",Math.PI)
document.writeln("<br>SQRT1_2 = ",Math.SQRT1_2,
"<br>SQRT2 = ",Math.SQRT2,"<br>")
</SCRIPT></BODY></HTML>


Dr.Andreas Mueller
Fri Jun 13 07:55:13 MET DST 1997