Per usare particolari funzioni e costanti matematiche, come ad es. π e x → |x|, si deve far precedere il nome da Math.: Math.PI, Math.abs(x). Se dopo <script> si mette with(Math){ e prima di </script> si mette }, si possono usare semplicemente i nomi: PI, abs(x).
To use particular mathematical functions and constants, such as eg. π and x → |x|, the name must be preceded by Math.: Math.PI, Math.abs(x). If after <script> you put with(Math){ and before </script> you put }, you can simply use the names: PI, abs(x).
Funzioni e costanti matematiche / Mathematical functions and constants:
abs(a) // the absolute value of a acos(a) // arc cosine of a asin(a) // arc sine of a atan(a) // arc tangent of a atan2(a,b) // arc tangent of a/b ceil(a) // integer closest to a and not less than a cos(a) // cosine of a exp(a) // exponential of a floor(a) // integer closest to and not greater than a log(a) // log of a base e max(a,b) // the maximum of a and b min(a,b) // the minimum of a and b pow(a,b) // a to the power b random() // pseudorandom number in the range 0 to 1 round(a) // integer closest to a sin(a) // sine of a sqrt(a) // square root of a tan(a) // tangent of a PI // π exp(1) // e