Arithmetic/Rational: Difference between revisions

Content added Content deleted
(Frink)
Line 1,114: Line 1,114:


=={{header|Frink}}==
=={{header|Frink}}==
Rational numbers are built into Frink and the numerator and denominator can be arbitrarily-sized. They are automatically simplified into simplest form, and collapsed into integers if necessary. All functions in the language can work with rational numbers.
Rational numbers are built into Frink and the numerator and denominator can be arbitrarily-sized. They are automatically simplified and collapsed into integers if necessary. All functions in the language can work with rational numbers. Rational numbers are treated as exact. Rational numbers can exist in complex numbers or intervals.
<lang frink>
<lang frink>
1/2 + 2/3
1/2 + 2/3
Line 1,124: Line 1,124:
1/sextillion
1/sextillion
// 1/1000000000000000000000 (exactly 1e-21)
// 1/1000000000000000000000 (exactly 1e-21)

8^(1/3)
// 2 (note the exact integer result.)
</lang>
</lang>