Do rational types such as circuitry exist in other languages?

I haven't heard anything, most languages ​​seem to just have an ints round split or a floating point number. Was it found that the problem is in the circuit and therefore is not used in other languages?

+3
source share
4 answers

The principles of rationality have bonuses supporting them. Most languages ​​do not have built-in bonuses.

In my opinion, it makes no sense to have built-in rational solutions without built-in bonuses, because without bonuses you begin to lose accuracy after a certain point, and you can also be aware of losses using floating point.

+2
source

? , Smalltalk :

(4/5) + (3/2) 

:

(23/10)
+4

Lisp:

CL-USER> (+ 4/5 3/2)
23/10

:

( scratchpad ) 4/5 3/2 + .
23/10

Haskell 98:

Prelude> (4/5) + (3/2) :: Rational
23 % 10
+4

: " ?" "", . , Scheme/Racket, , , "" " " "" . , , , , . Scheme/Racket , , , . Garbage, , .

As Chris points out, representing numbers as rational almost always goes hand in hand with “bignums”. There are tons of languages ​​that support bignums - Scheme, Racket, Ruby, Python, etc. - and, of course, any language containing the full language can be extended for bing processing, including C.

+2
source

All Articles