-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: * Removed some unused CSS rules. * Made the layout look more like a physical calculator. * Updated math.js library from 13.0.0 to 13.1.1.
- Loading branch information
Showing
1 changed file
with
28 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Fixed Calculator 2.0</title> | ||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> | ||
<style> | ||
body {background-color: #222; position: relative; left: 10px; width: 90vw; height: 90vh;} | ||
a, div, h1, p, span, th, td {color: #fff; font-family: verdana;} | ||
#equation {font-size: 25px; width: 1000px; display: block; margin: 20px 0px;} | ||
#result {font-size: 150%;} | ||
table {position: relative; top: 50px;} | ||
td {width: 200px;} | ||
.func {border: 1px solid #fff; width: 100px; text-align: center} | ||
</style> | ||
<script src="https://unpkg.com/[email protected]/lib/browser/math.js"></script> | ||
</head> | ||
<body> | ||
<h1>Fixed Calculator 2.0</h1> | ||
<span>A Javascript calculator with fixed decimals and functions. I rewrote this calculator using <a href="https://mathjs.org">math.js</a>.<br></span> | ||
<span>Big numbers up to 10^(9*10^15), complex numbers, and high precision (50 digits) is supported.</span> | ||
<input id="equation"> | ||
<div id="result"></div> | ||
<br> | ||
<p><b>Supported Operators and Functions<br></b> | ||
+, -, *, /, ( ), ^, !, %, e, pi, tau, phi, i, deg, rad<br> | ||
sqrt(x), cbrt(x), log(x), log10(x), log2(x), log(x, y)<br> | ||
floor(x), round(x), ceil(x), abs(x), sign(x), exp(x)<br> | ||
re(x), im(x), conj(x), lcm(x, y, z...), gcd(x, y, z...)<br> | ||
sin(x), cos(x), tan(x), csc(x), sec(x), cot(x)<br> | ||
asin(x), acos(x), atan(x), acsc(x), asec(x), acot(x)<br> | ||
sinh(x), cosh(x), tanh(x), csch(x), sech(x), coth(x)<br> | ||
asinh(x), acosh(x), atanh(x), acsch(x), asech(x), acoth(x)<br> | ||
</p> | ||
<script> | ||
math.config({number: "BigNumber", precision: 100}); | ||
setInterval(function() { | ||
result.innerHTML = "<b> = " + math.format(math.evaluate(equation.value), {lowerExp: -10, upperExp: 25, precision: 50}) + "</b>"; | ||
}); | ||
</script> | ||
</body> | ||
<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;} | ||
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: 95%;} | ||
#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 calculator to support all your needs. Supports various functions, arbitrary precision, and complex numbers. Powered by math.js.</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> | ||
<script> | ||
setInterval(function() { | ||
math.config({number: "BigNumber", precision: Number(precision.value)}); | ||
answer.innerHTML = math.format(math.evaluate(equation.value), {lowerExp: -Number(precision.value), upperExp: Number(precision.value)}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |