<commit_before>/*
    Copyright (C) 2015 <NAME>

    This file is part of Arb.

    Arb is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include "acb.h"

void
acb_acos(acb_t res, const acb_t z, slong prec)
{
    if (acb_is_one(z))
    {
        acb_zero(res);
    }
    else
    {
        acb_t t;
        acb_init(t);
        if (arb_is_zero(acb_imagref(z)))
        {
            arb_t one;
            arb_init(one);
            arb_one(one);
            if (arb_gt(acb_realref(z), one))
            {
                acb_zero(t);
                acb_asin(res, z, prec);
                acb_sub(res, t, res, prec);
                arb_zero(acb_realref(res));
                arb_clear(one);
                arb_clear(t);
                return;
            }
            arb_clear(one);
        }
        acb_asin(res, z, prec);
        acb_const_pi(t, prec);
        acb_mul_2exp_si(t, t, -1);
        acb_sub(res, t, res, prec);
        acb_clear(t);
    }
}
<commit_msg>use acb_neg<commit_after>/*
    Copyright (C) 2015 <NAME>

    This file is part of Arb.

    Arb is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include "acb.h"

void
acb_acos(acb_t res, const acb_t z, slong prec)
{
    if (acb_is_one(z))
    {
        acb_zero(res);
    }
    else
    {
        acb_t t;
        acb_init(t);
        if (arb_is_zero(acb_imagref(z)))
        {
            arb_t one;
            arb_init(one);
            arb_one(one);
            if (arb_gt(acb_realref(z), one))
            {
                acb_asin(res, z, prec);
                acb_neg(res, res);
                arb_zero(acb_realref(res));
                arb_clear(one);
                arb_clear(t);
                return;
            }
            arb_clear(one);
        }
        acb_asin(res, z, prec);
        acb_const_pi(t, prec);
        acb_mul_2exp_si(t, t, -1);
        acb_sub(res, t, res, prec);
        acb_clear(t);
    }
}

{'fraction_non_alphanumeric': 0.10921926910299003, 'fraction_numerical': 0.006644518272425249, 'mean_word_length': 1.609967497291441, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3156562', 'n_tokens_mistral': 885, 'n_tokens_neox': 841, 'n_words': 212}