Search code examples
schemeracketdivisionrepresentationrational-numbers

Do any other languages have builtin rational types like scheme?


I haven't heard of any, most languages seem to just have division of ints round or be a floating point number. Was it found to be a problem in scheme and so not used in other languages?


Solution

  • Scheme's rationals have bignums backing them. Most languages don't have built-in bignums.

    In my opinion, it's pointless to have built-in rationals without built-in bignums, because without bignums, you start to lose precision after a certain point, and you may as well be upfront about the lossiness by using floating-point.