Hacker News new | past | comments | ask | show | jobs | submit login

They have this totally irrational idea of having "rational" numbers.


By irrational I am not joking, these sorts of number systems are complicated and glitchy, in this case with program-destroying magic like autoconversion to floating point when you hit a 2^64 denominator, and, don't click this URL, please, just read it:


> totally irrational idea

Could you expand on why it is a totally irrational idea? Seems pretty rational to me. But then I'm not really a mathematician.

> autoconversion to floating point when you hit a 2^64 denominator

Please note that this is after normalization. And it has come from practicality: having the denominator also be an BigInt, slows down the use of the Rational number significantly. However, if you do need that type of precision, then you can by using infectious FatRats: any expression with a FatRat, will result in a FatRat (unless explicitly coerced to something else, of course).

With regards to the Zero-denominator Rats: they are just special cases just as IEEE has special cases for -Inf, Inf and NaN. So what's the problem there?

It adds gratuitous corner cases to the language.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact