Friday, April 27, 2018

JavaScript’s Tricky Rounding

Peter Ammon:

Unfortunately, the implementation in the spec does not correctly implement the spec.


JavaScript presumably rounds this odd way to match Java, and so the only engine to get it right out of the gate is Rhino, which simply calls back to Java’s Math.round. Amusingly Oracle fell into the same trap with Rhino’s successor Nashorn. Round and round we go!

Comments RSS · Twitter

Leave a Comment