The original explanation present was: View the Firefox source, 'toFixed' method is to convert the value of the conversion, not the standard implementation.
... That does not make sense... convert the value of the conversion? What?
It's just Firefox and Chrome obeying IEEE-754 Floating Point standards as closely as possible, and Internet Explorer doing whatever IE does all day (nobody really knows).
In fact, you can see that C++ will do the same thing: double x = 0.7875; cout << setprecision(3) << x << endl; yields 0.787, demonstrated on: https://ideone.com/TJzyhj
The original explanation present was:
View the Firefox source, 'toFixed' method is to convert the value of the conversion, not the standard implementation.
... That does not make sense... convert the value of the conversion? What?
It's just Firefox and Chrome obeying IEEE-754 Floating Point standards as closely as possible, and Internet Explorer doing whatever IE does all day (nobody really knows).
In fact, you can see that C++ will do the same thing:
double x = 0.7875; cout << setprecision(3) << x << endl;
yields0.787
, demonstrated on: https://ideone.com/TJzyhj