-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixed-calculator.html
32 lines (32 loc) · 1.59 KB
/
fixed-calculator.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
<!DOCTYPE html>
<html>
<head>
<title>Fixed Calculator 3.0</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<style>
body {background-color: #222; position: relative; left: 10px; width: 98vw;}
h1, p, span {color: #fff; font-family: verdana;}
span {position: relative; top: 1px;}
input, textarea {background-color: #444; color: #fff;}
#equation, #answer {display: block; margin: 4px 0px; font-size: 150%; width: 98%;}
#answer {height: 500px; resize: none;}
</style>
<script src="https://unpkg.com/[email protected]/lib/browser/math.js"></script>
</head>
<body>
<h1>Fixed Calculator 3.0</h1>
<p>An all-in-one online calculator to support most needs. Supports various functions, arbitrary precision, and complex numbers. Powered by <a href="https://mathjs.org">math.js</a>.</p>
<span>Precision </span><input type="number" id="precision" value=100>
<span>Supports functions like:</span>
<span style="font-family: consolas"><b>+ - * / ^ % ! pi e sqrt() cbrt() log() sin() cos() tan() abs()</b></span>
<input type="text" id="equation" value="1 + 1">
<textarea id="answer"></textarea>
<p>If you wish for offline, faster calculations, but with less functions, try the sister program, <a href="https://github.com/mcnole25/random-resources/blob/master/precise-calculator.html">Precise Calculator</a>.</p>
<script>
setInterval(function() {
math.config({number: "BigNumber", precision: Number(precision.value) + 10});
answer.innerHTML = math.format(math.evaluate(equation.value), {lowerExp: -Number(precision.value), upperExp: Number(precision.value), precision: Number(precision.value)});
});
</script>
</body>
</html>