> "easily stored on a computer" is too vague and reductive.

Fwiw, from the compiler source code:

my role Rational[::NuT, ::DeT] does Real {
has NuT $.numerator;
has DeT $.denominator;

> Your position seems to be that rational arithmetic is an obvious choice

Yes. Rational storage and rational arithmetic is an obvious choice for storing and processing rational numbers. (Alongside the other obvious choice -- using floats.)

> other languages have been too lazy or stupid

I'm extolling what I consider a minor Perl 6 virtue. Where have I been negative toward other languages?

> rational arithmetic is a fine choice for ...

... doing rational arithmetic.

> it is not a strict improvement over other number representations.

For representing Integers? Sure. Irrationals? Agreed. Complex numbers? Gotchya. Number crunching where absolute exactness is not necessary? Use floats.

But if exactness is required and a formula only involves rational numbers (and integers) then rational storage and processing is a strict improvement over use of floats.

> [rationals are] not as perfect, and floating point is not as bad, as you seem to think.

When did I suggest floats are bad? The general number type in Perl 6 is a float. Floats are awesome! But floats are by design not exact for arbitrary rational numbers. Their awesomeness derives directly from them being inexact in this way.

When did I suggest storing rationals is perfect? They use up more memory than floats and processing can become pathologically slow if the denominators get big enough. This problem derives directly from them being exact.

> doubles have lots of values they can't represent perfectly, but so do rationals. Like sqrt(2), sin(1), pi

Those are explicitly defined in mathematics as numbers that are not rational. Rational storage and arithmetic is for representing and processing numbers that are rational!

One can't exactly store an irrational number. The Perl 6 compiler defines a constant for the irrational number `pi`:

my constant pi = 3.14159_26535_89793_238e0;

The 'e0' on the end means that `pi` is stored as a float.

> Some slides I found about Perl 6 indicate that Rat values lose precision if the denominator gets too big, to avoid using too much memory.

The numerator of a default rational (a non-parameterized Rat) can be arbitrarily large but if the denominator exceeds 64 bits (20 decimal digits) then the compiler converts the number to a float.

If you don't like that then you can use a rational with a larger denominator, with the extreme being a FatRat that has an arbitrary sized denominator as well as arbitrary sized numerator.

> If this is true, the Rat type shouldn't be thought of as an "exact" type any more than double

I think that view misses something very important. This is indeed where the discussion could get interesting. We shall see. It seems we needed to get past a lot of misunderstanding first.

> What I'm disagreeing with overall is the dichotomy you are trying to create of: double=approximate, Perl 6 number=exact.

I've never said that. What I have said is that, for storing and processing rational numbers, doubles are approximate (and they are); that it's possible to be exact instead (and it is); and that Perl 6 returns True for the expression `0.1 + 0.2 == 0.3` because by default it processes rationals as exact rationals.

> There are cases where double is exact

Not for rational numbers (I'm ignoring silly examples like 1/1 and others that happen to work out because the denominator and numerators are powers of two or whatever).

> and cases where Perl 6 is not exact.

Not for rational numbers, if you choose to have them be exact.