I have created an algorithm for the base of the natural logarithm with HTML and JS. And this is the code:
HTML: bonl.html
<html>
<head>
<title>bonl</title>
</head>
<body>
<script src="bonl.js"></script>
<input type="number" id="entered">
<input type="button" value="run" onclick="calculate()">
<div id="bonl">
</body>
</html>
and Javascript: bonl.js
function calculate() {
var x = document.getElementById('entered').value;
console.log(x);
var e = (1 + (1/x))**x;
console.log(e);
document.getElementById('bonl').innerHTML = e;
}
First, you assign a number value to <input type="number" id="entered">, and click the button named 'run'. After that, var x in bonl.js will be equal to the number assigned to 'entered'. Then, according to the definition of the base of the natural logarithm (e = lim x->inf (1+(1/x)**x)), the Javascript file will calculate the e. And the result will be displayed by <div id="bonl">.
I hope you noticed that as the value of the x gets larger, javascript file calculates the base of the natural logarithm more accurately.
However, I entered about 10 quadrillion in <input type="number" id="entered">, and I've got the result of 1 instead of 2.71828.., although I get 2.71828 when I enter 100 trillion in <input type="number" id="entered">.
Is my computer dumb to calculate e, or is there an error in my code, or is e = 1?