-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut61.html
More file actions
107 lines (61 loc) · 2.79 KB
/
Copy pathtut61.html
File metadata and controls
107 lines (61 loc) · 2.79 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Math Object </title>
</head>
<body>
<div class="container">
<h1>This is math object tutorial</h1>
</div>
<script>
let m = Math;
console.log(m);
// printing the constraints from math objects
console.log("The value of Math.E", Math.E)
console.log("The value of Math.LN2", Math.LN2)
console.log("The value of Math.LN10", Math.LN10)
console.log("The value of Math.LOG2E", Math.LOG2E)
console.log("The value of Math.SQRT2", Math.SQRT2)
// printing the functions from math object
let a = 34.64534;
let b = 89;
console.log("the value of a and b is ", a, b)
console.log("the value of a and b rounded is ", Math.round(a), Math.round(b));
console.log(" 3 raised to the power of 2 is ", Math.pow(3,2))
console.log(" 5 raised to the power of 2 is ", Math.pow(5,2))
console.log(" 2 raised to the power of 2 is ", Math.pow(2,2))
console.log(" 887 raised to the power of 2 is ", Math.pow(887,2))
console.log(" squre root of 3 is ", Math.sqrt(3))
console.log(" squre root of 36 is ", Math.sqrt(36))
console.log(" squre root of 37 is ", Math.sqrt(37))
console.log(" squre root of 38756 is ", Math.sqrt(38756))
// ceil and floor
console.log(" 3.7 rounded up to nearest integer ", Math.ceil(3.7))
console.log(" 99.9 rounded up to nearest integer ", Math.ceil(99.9))
console.log(" 99.9 rounded down to nearest integer ", Math.floor(99.9))
console.log(" 7.3 rounded down to nearest integer ", Math.floor(7.3))
// absoloute or abs function
console.log(" absolute value of 7.36976 is ", Math.abs(7.36976))
console.log(" absolute value of -7.36976 is ", Math.abs(7.36976))
// trignometric funcitons
console.log("The value of sin(pi/2) is ", Math.sin(Math.PI/2))
console.log("The value of tan(pi/2) is ", Math.tan(Math.PI/2))
console.log("The value of cos(pi/2) is ", Math.cos(Math.PI/2))
// min and max function
console.log("minimum value of 4, 5. 6, 7 is", Math.min(4,5,6,7));
console.log("minimum value of 98, 99, 100, 3 is", Math.min( 98, 99,100, 3));
console.log("minimum value of 4, 5. 6, 7 is", Math.max(4,5,6,7));
console.log("minimum value of 98, 99, 100, 3 is", Math.max( 98, 99,100, 3));
// Genrating a random number
let r = Math.random();
console.log("the random number is ", r)
// Random number between (a,b) = a + (b-a)*Math.random()
let x = 1;
let Y = 100;
let r1_100 = x + (Y-x)*Math.random()
console.log("the random number is ", r1_100)
</script>
</body>
</html>