On Mon, Nov 1, 2021 at 2:35 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote:
> On 10/31/21 19:39, Sean McAfee wrote: > > > (2.FatRat, { $_ / 2 + 1 / $_ } ... (* - *).abs < 1e-100).tail > > 1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846230912297024924836055850737212644121497099935831413222665927505592755799950501152782060571 > > > Awesome! > Note that what you have there is a 200-decimal-digit (around 658-bit) precision representation of the square root of 2 - which is quite different to the (53-bit precision) Real sqrt(2). If you obtained a 200-decimal-digit representation of that original Real, you'd end up with: 1.4142135623730951454746218587388284504413604736328125 That has, of course, significantly fewer digits than 200 - the reason being that the missing (147) additional digits are all zeros. That is, 1.4142135623730951454746218587388284504413604736328125 is an exact decimal representation of the actual precise value held by the Real sqrt(2). >From that it can be established that the exact rational representation of the Real sqrt(2) is 6369051672525773/4503599627370496. I don't know how all of that could be done in raku. In perl: C:\>perl -le "printf '%.200g', sqrt 2;" 1.4142135623730951454746218587388284504413604736328125 C:\>perl -MMath::BigRat -le "print Math::BigRat->new(Math::BigFloat->new('1.4142135623730951454746218587388284504413604736328125'));" 6369051672525773/4503599627370496 Anyway ... this is probably not all that relevant ... especially if you were actually just seeking a higher-precision calculation of sqrt(2) than the Real provides. Cheers, Rob