# New Ticket Created by  Dan Kogai 
# Please include the string:  [perl #127201]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127201 >


This is possibly related to https://rt.perl.org/Ticket/Display.html?id=127184 .
Run the code below:

    #!/usr/bin/env perl6
    use v6;
    my $log2 = log(2);
    for 0..20 {
        say sprintf "%%.%dg:\t%.{$_}g", $_, $log2;
    }

and you get:

    %.0g:   1
    %.1g:   0.7
    %.2g:   0.69
    %.3g:   0.693
    %.4g:   0.6931
    %.5g:   0.69315
    %.6g:   0.693147
    %.7g:   0.6931472
    %.8g:   0.69314718
    %.9g:   0.693147181
    %.10g:  0.6931471806
    %.11g:  0.69314718056
    %.12g:  0.69314718056
    %.13g:  0.6931471805599
    %.14g:  0.69314718055995
    %.15g:  0.693147180559945
    %.16g:  0.693147180559945
    %.17g:  0.693147180559945
    %.18g:  0.693147180559945
    %.19g:  0.693147180559945
    %.20g:  0.693147180559945

With perl5 version:

    #!/usr/bin/env perl
    use v5.22;
    use warnings;
    my $log2 = log(2);
    for (0..20) {
        say sprintf "%%.%dg:\t%.${_}g", $_, $log2;
    }

    %.0g:       0.7
    %.1g:       0.7
    %.2g:       0.69
    %.3g:       0.693
    %.4g:       0.6931
    %.5g:       0.69315
    %.6g:       0.693147
    %.7g:       0.6931472
    %.8g:       0.69314718
    %.9g:       0.693147181
    %.10g:      0.6931471806
    %.11g:      0.69314718056
    %.12g:      0.69314718056
    %.13g:      0.6931471805599
    %.14g:      0.69314718055995
    %.15g:      0.693147180559945
    %.16g:      0.6931471805599453
    %.17g:      0.69314718055994529
    %.18g:      0.693147180559945286
    %.19g:      0.6931471805599452862
    %.20g:      0.69314718055994528623

Dan the Inaccurate Perl Monger

Reply via email to