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?
4 Answers
Are you asking about fractions? If so, Smalltalk has them:
(4/5) + (3/2)
evaluates to:
(23/10)
-
Oppened up pharo and yep, weird that I didn't notice that(I haven't done very much smalltalk but still). – Roman A. Taycher Jun 13 '11 at 09:50
Common Lisp:
CL-USER> (+ 4/5 3/2)
23/10
Factor:
( scratchpad ) 4/5 3/2 + .
23/10
Haskell 98:
Prelude> (4/5) + (3/2) :: Rational
23 % 10

- 15,497
- 4
- 39
- 47
-
1FWIW Clojure's ratios behave the same as the Common Lisp ratios in this answer. – amalloy Jul 17 '11 at 04:39
You ask: "Was it found to be a problem in scheme and so not used in other languages?" The answer to that is "no", but it's an interesting question. Broadly speaking, Scheme/Racket is perhaps emblematic of a family of languages which, when given a choice between "correct" and "simple to implement", choose "correct" every time. The choice made by many other languages is to explicitly expose the representations of numbers as elements of a small finite set, and to require the programmer to operate in that sphere. Scheme/Racket instead provides a representation that can handle arbitrarily large numbers, limited only by the memory of the machine evaluating the code. This is not unlike the decision made by nearly all modern programming languages to use Garbage Collection, rather than forcing the programmer to explicitly allocate and deallocate memory.
As Chris points out, the representation of numbers as rationals almost always goes hand-in-hand with "bignums". There are a bunch of languages that support bignums--Scheme, Racket, Ruby, Python, etc.--and of course, any turing-complete language can be extended to handle bignums, including C.

- 16,895
- 3
- 37
- 52
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.

- 219,335
- 46
- 382
- 435