DevHeads.net

Behaviour of round changed?

I am moving some algorithms between 1.9.3 and 2.4.2 and found (after much
head scratching)

2.4.2 :001 > 1.015.round(2)
=> 1.02

1.9.3-p551 :001 > 1.015.round(2)
=> 1.01

We are calculating margin prices and round input values to 2 places because
the precision is not needed and it can help with caching

The tests broke :(

Let me see if I understand this, Ruby has changed how basic maths functions
work

Can I trust ceil, floor, truncate or any of the other number related
functions?

Do I need to write tests for the language itself for when I upgrade to a
newer version in the future or should I stick with 1.9.3 for all eternity?

A change at this low a level is almost impossible to speculatively test
for, if I cannot trust the language I am using I cannot trust my code at all

I am now in a position of having to test my code to an excessive degree
because I cannot trust there are not any other changes that will be
triggered on some previously innocent edge case

I am extremely pissed off right now