Hacker News new | ask | show | jobs
by Dajve_Bloke 2552 days ago
NB - you get the same result in MS-SQL (and for exactly the same reason).

Ruby behaves like SQL in that appending a decimal to the values results in non-integer maths being employed.

MS-SQL itself is slightly out (I assume due to floating point inaccuracy)

SELECT (289.0 / 30.0 * 30.0) - (149.0 / 30.0 * 30.0) 140.0000100