-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_object.js
30 lines (28 loc) · 1.51 KB
/
math_object.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var br = '<br/>';
document.write("ceil(8.5) is " + Math.ceil(8.5) + br);
document.write("PI's value is " + Math.PI + br);
document.write("Square Root of 3 is " + Math.sqrt(3) + br);
document.write("max(8,92) = " + Math.max(8,92) + br);
document.write("min(8,92) = " + Math.min(8,92) + br);
document.write("Generating a Random number betwee [0,1]: " + Math.random() + br);
document.write("round(90.51) = " + Math.round(90.51) + br);
document.write("Euler's Constant e = " + Math.E + br);
var log2 = Math.log2(2);
document.write("Natural Log of 2 (Base 2) = " + log2 + br);
document.write("Natural Log of 2 (Base 10) = " + Math.log10(2) + br);
document.write("Sign of -563 is " + Math.sign(-563) + br);
document.write("trunc(10.09923) = " + Math.trunc(10.09923) + br);
document.write("10<sup>9.473</sup> = " + Math.pow(10,9.473) + br);
document.write("abs(-299) = " + Math.abs(-299) + br);
document.write("sin(90°) = " + Math.sin(90) + br);
/*
Math Object has the following Properties:
Math.E - Euler's constant and the base of natural logarithms, approximately 2.718.
Math.LN2 - Natural logarithm of 2, approximately 0.693.
Math.LN10 - Natural logarithm of 10, approximately 2.303.
Math.LOG2E - Base 2 logarithm of E, approximately 1.443.
Math.LOG10E - Base 10 logarithm of E, approximately 0.434.
Math.PI - Ratio of the circumference of a circle to its diameter, approximately 3.14159.
Math.SQRT1_2 - Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.
Math.SQRT2 - Square root of 2, approximately 1.414.
*/