MHN
Add a comment on Hacker News →
2 of 13 comments
  1. Both ints and floats represent real, rational values, but every operation in no way matches math. Associative? No. Commutative? No. Partially Ordered? No. Weakly Ordered? No. Symmetric? No. Reflexive? No. Antisymmetric? No. Nothing.

    The only reasonable way to compare rationals is the decimal expansion of the string.

  2. Julia gets this right. casting to both double and int, it does both a floating point compare and an integer compare , then AND them and return