I can't figure out the reason 100000000000000030/10 = 10000000000000004
in JavaScript, I haven't seen this problem in other questions.
<script>
alert(100000000000000030/10);
</script>
I can't figure out the reason 100000000000000030/10 = 10000000000000004
in JavaScript, I haven't seen this problem in other questions.
<script>
alert(100000000000000030/10);
</script>
Before doing this calculation you may want to know that whether this number is a safe javascript number or not. you can use - Number.isSafeInteger(100000000000000030), to know that.
"The MAX_SAFE_INTEGER constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). The reasoning behind that number is that JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and can only safely represent numbers between -(253 - 1) and 253 - 1."
You may also want to read more here - Division and remainder of large numbers in JavaScript