Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
arekxv10528yWow. I'm dissapointed. Thats gotta be the stupidest thing to do ever. This will break so many systems and make people pull their hair. Its not intuitive at all.
-
arekxv10528y@b0ni I know its IEEE 754, thats not the point. There are standards, but if many people and languages are not using them then why bother to conform to the standard like that, especially when it goes against Ruby's philosophy of "It works like you expect it to".
-
So .NET gives you a way to decide in which way you want to round using the Math.Round(); function with a dedicated parameter.
Furthermore, you can tell the function how much precision have to be used while rounding (number of decimals)
Is ruby giving you these kind of options after this major change in rounding? -
Makes sense. 2 is by far the roundest number, so all numbers should round to 2.
-
BartBB6898yThat's not the case actually. From 1.5 if it rounds up, it should be 2. So from 2.5 it should round up as well, but it doesn't because it aims for the closest EVEN number.
4.5 and 3.5 would both give 4. @thejohnhoffer
Ruby 2.3
1.5.round == 2
2.5.round == 3
Ruby 2.4
1.5.round == 2
2.5.round == 2
Have Fun!
undefined