<commit_before>use 5.014;
use warnings;

our ($ROUND, $PREC);

sub __bernreal__ {
    my ($n) = @_;    # $n is an unsigned integer

    if ($n == 0) {
        my $r = Math::MPFR::Rmpfr_init2($PREC);
        Math::MPFR::Rmpfr_set_ui($r, 1, $ROUND);
        return $r;
    }

    if ($n == 1) {
        my $r = Math::MPFR::Rmpfr_init2($PREC);
        Math::MPFR::Rmpfr_set_d($r, 0.5, $ROUND);
        return $r;
    }

    if ($n & 1) {    # Bn = 0 for odd n>1
        my $r = Math::MPFR::Rmpfr_init2($PREC);
        Math::MPFR::Rmpfr_set_ui($r, 0, $ROUND);
        return $r;
    }

    my $f = Math::MPFR::Rmpfr_init2($PREC);
    my $p = Math::MPFR::Rmpfr_init2($PREC);

    Math::MPFR::Rmpfr_zeta_ui($f, $n, $ROUND);    # f = zeta(n)
    Math::MPFR::Rmpfr_set_ui($p, $n + 1, $ROUND); # p = n+1
    Math::MPFR::Rmpfr_gamma($p, $p, $ROUND);      # p = gamma(p)
    Math::MPFR::Rmpfr_mul($f, $f, $p, $ROUND);    # f = f * p

    Math::MPFR::Rmpfr_const_pi($p, $ROUND);       # p = PI
    Math::MPFR::Rmpfr_pow_ui($p, $p, $n, $ROUND); # p = p^n

    Math::MPFR::Rmpfr_div_2exp($f, $f, $n - 1, $ROUND);    # f = f / 2^(n-1)

    Math::MPFR::Rmpfr_div($f, $f, $p, $ROUND);             # f = f/p
    Math::MPFR::Rmpfr_neg($f, $f, $ROUND) if $n % 4 == 0;

    $f;
}
<commit_msg>- Replaced `Rmpfr_div_2exp()` with `Rmpfr_div_2ui()` in __bernreal__().<commit_after>use 5.014;
use warnings;

our ($ROUND, $PREC);

sub __bernreal__ {
    my ($n) = @_;    # $n is an unsigned integer

    if ($n == 0) {
        my $r = Math::MPFR::Rmpfr_init2($PREC);
        Math::MPFR::Rmpfr_set_ui($r, 1, $ROUND);
        return $r;
    }

    if ($n == 1) {
        my $r = Math::MPFR::Rmpfr_init2($PREC);
        Math::MPFR::Rmpfr_set_d($r, 0.5, $ROUND);
        return $r;
    }

    if ($n & 1) {    # Bn = 0 for odd n>1
        my $r = Math::MPFR::Rmpfr_init2($PREC);
        Math::MPFR::Rmpfr_set_ui($r, 0, $ROUND);
        return $r;
    }

    my $f = Math::MPFR::Rmpfr_init2($PREC);
    my $p = Math::MPFR::Rmpfr_init2($PREC);

    Math::MPFR::Rmpfr_zeta_ui($f, $n, $ROUND);    # f = zeta(n)
    Math::MPFR::Rmpfr_set_ui($p, $n + 1, $ROUND); # p = n+1
    Math::MPFR::Rmpfr_gamma($p, $p, $ROUND);      # p = gamma(p)
    Math::MPFR::Rmpfr_mul($f, $f, $p, $ROUND);    # f = f * p

    Math::MPFR::Rmpfr_const_pi($p, $ROUND);       # p = PI
    Math::MPFR::Rmpfr_pow_ui($p, $p, $n, $ROUND); # p = p^n

    Math::MPFR::Rmpfr_div_2ui($f, $f, $n - 1, $ROUND);    # f = f / 2^(n-1)

    Math::MPFR::Rmpfr_div($f, $f, $p, $ROUND);            # f = f/p
    Math::MPFR::Rmpfr_neg($f, $f, $ROUND) if $n % 4 == 0;

    $f;
}

{'fraction_non_alphanumeric': 0.22478829869130101, 'fraction_numerical': 0.020785219399538105, 'mean_word_length': 2.5602739726027397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3367056', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1215, 'n_words': 236}