For example, I know 0.12,ie:
const a=0.12;
rounds to something due to float number errors. However, I'm not asking why the error happens and I don't care the errors currently, instead I want to know if the hardcode form always equals to the value after adding toFixed following Number.parseFloat.
Consider the following:
console.log(0.12 == Number.parseFloat(0.12.toFixed(2)));
console.log(987.123 == Number.parseFloat(987.123.toFixed(3)));
console.log(98765.12345678 == Number.parseFloat(98765.12345678.toFixed(8)));
the hardcode values above equals to the value after adding toFixed(n) and Number.parseFloat.
However, I don't know if other cases are also true. So my question is, for a float number a.bc... with n decimals 0-100 and value between MIN_VALUE and MAX_VALUE, does its original hardcode form rounds to the value always the same as Number.parseFloat(a.bc.toFixed(n)) ? ie:
console.log(a.bc... == Number.parseFloat((a.bc...).toFixed(n))); //"bc..." means n decimals, 0 <= n <= 100 , MIN_VALUE <= a.bc <= MAX_VALUE
does the code above always true? If it does, does it also true for -a.bc..? And if it doesn't, what is the reason?