From a0048653aaf648839be2d6ce4a3fd25cd9dd47fe Mon Sep 17 00:00:00 2001 From: cfa <215106+cfa@users.noreply.github.com> Date: Fri, 22 Feb 2019 08:13:02 -0800 Subject: [PATCH] Rat degradation example. --- doc/Language/numerics.pod6 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/Language/numerics.pod6 b/doc/Language/numerics.pod6 index de25e9e10..1d0253fee 100644 --- a/doc/Language/numerics.pod6 +++ b/doc/Language/numerics.pod6 @@ -210,8 +210,20 @@ say ½ + ⅓ + ⅝ + ⅙; # OUTPUT: «1.625␤» If a I that produces a L answer would produce a L with denominator larger than 64 bits, that operation would instead return a L object. When I a L (i.e. when it is not -a result of some mathematical expression), however, a "fattish" L with -larger denominator will be created. +a result of some mathematical expression), however, a larger denominator can be used: + + my $a = 1 / (2⁶⁴ - 1); + say $a; # OUTPUT: «0.000000000000000000054␤» + say $a.^name; # OUTPUT: «Rat␤» + + my $b = 1 / 2⁶⁴; + say $b; # OUTPUT: «5.421010862427522e-20␤» + say $b.^name; # OUTPUT: «Num␤» + + my $c = Rat.new(1, 2⁶⁴); + say $c; # OUTPUT: «0.000000000000000000054␤» + say $c.^name; # OUTPUT: «Rat␤» + say $c.Num; # OUTPUT: «5.421010862427522e-20␤» =head2 C