-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalc.html
191 lines (146 loc) · 4.39 KB
/
Calc.html
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCKTYPE html>
<html>
<style>
body{
background-color: orange;
}
button {
width: 100px;
height: 100px;
left: 10px;
margin-top: 10px;
font-size: 30px;
margin-bottom: 5px;
margin-left: 5px;
font-family:"Courier New", Courier, monospace;
background-color: lightblue;
box-shadow: 3px 3px;
}
</style>
<body>
<div style="background-color: gray; border: black 10px soild; width: 450px; box-shadow: 5px 5px;">
<input type="text" id="type" name="type" style="width: 450px; height: 110px; font-size: 40px; box-shadow: 0px 3px;"></input>
<input type="text" id="type2" name="type2" style="width: 450px; height: 110px; font-size: 40px; box-shadow: 0px 3px;"></input>
<br>
<button id="btn+" onclick="add1()">+</button>
<button id="btn-" onclick="sub1()">-</button>
<button id="btn*" onclick="multi()" style="">*</button>
<button id="btn/" onclick="unk3()" style="">/</button>
<br>
<button id="btn^" onclick="squ1()">^2</button>
<button id="btn^^" onclick="unk4()">^3</button>
<button id="btn^R" onclick="squ1R()">rt</button>
<button id="btn^R" onclick="squ3R()">3rt</button>
<br>
<button id="btnVV" onclick="unk2()">0.x</button>
<button id="btn\" onclick="fac()">fact</button>
<button id="btn|" onclick="un2()">|n|</button>
<button id="btn." onclick="un22()">pi</button>
<br>
<button id="btn~" onclick="un2k()">~</button>
<button id="btnC" onclick="unk1()">AC</button>
<button id="btnC" onclick="ran1()">Ran</button>
</div>
<p style="font-size: 230px; margin-top: -400px; margin-left: 600px;" id="Show_Calc"></p>
<p style="font-size: 100px; " id="Err"></p>
<div style="width: 380px; height: 40%;">
<p id="Imf" style="margin-top: -80px;">Welcome to the imfomation manule. BUTTONS: + for adding, - for subtracting, * for multiplying, / for divieding, ^2 of squaring, ^3 for cubeing, and C for reseting. NOTE: the text box is for * and / only.</p>
</div>
<script>
try{
//3.381391913522732e + 51
var calcN = 0;
var type = document.getElementById("type").value;
function add1(){
calcN ++;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function sub1(){
calcN = calcN - 1;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function squ1(){
calcN = calcN * calcN;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function squ1R(){
calcN = Math.sqrt(calcN);
document.getElementById("Show_Calc").innerHTML = calcN;
}
function squ3R(){
calcN = Math.cbrt(calcN);
document.getElementById("Show_Calc").innerHTML = calcN;
}
function unk1(){
type = document.getElementById("type").value;
calcN = 0;
type = 0;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function ran1(){
calcN = Math.floor(Math.random() * 101);
document.getElementById("Show_Calc").innerHTML = calcN;
}
function multi (){
type = document.getElementById("type").value;
var x = type;
calcN = (calcN * x);
//calcN = "Error";
document.getElementById("Show_Calc").innerHTML = calcN;
document.getElementById("type").value = calcN;
}
function unk3(){
type = document.getElementById("type").value;
var x = type;
calcN = (calcN / x);
//calcN = "Error";
document.getElementById("Show_Calc").innerHTML = calcN;
}
function un2k(){
calcN = Math.round(calcN);
document.getElementById("Show_Calc").innerHTML = calcN;
}
function unk4(){
calcN = calcN * calcN * calcN;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function squ2(){
calcN = calcN / calcN;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function unk2(){
calcN = calcN / calcN / calcN;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function un22(){
calcN = 3.141592653589793;
document.getElementById("Show_Calc").innerHTML = calcN;
}
function un2(){
if (calcN < 0){
calcN = calcN + calcN * -2;
document.getElementById("Show_Calc").innerHTML = calcN;
}else{
var calcNS = " (|" + calcN + "| = " + calcN + ")";
document.getElementById("Show_Calc").innerHTML = calcN && calcNS;
}
document.getElementById("Show_Calc").innerHTML = calcN && calcNS || calcN;
}
function fac(){
var IntegerF = Number.isSafeInteger(123);
if (IntegerF = true)
var calcN2 = calcN + "/" + "1";
document.getElementById("Show_Calc").innerHTML = calcN2;
}
if(calcN === Infinity){
calcN = "aleph 0";
}
document.getElementById("Show_Calc").innerHTML = calcN;
}
catch(err){
document.getElementById("Err").innerHTML = err.name + "<br>" + err.message;
alert(err.name + " " + err.message);
}
</script>
</body>
</html>