<commit_before>/*
    cmath.c:

    Copyright (C) 1994 <NAME>, <NAME>

    This file is part of Csound.

    The Csound Library is free software; you can redistribute it
    and/or modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    Csound is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Csound; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA
*/

/*      Math functions for Csound coded by <NAME> 1994         */
/*      Berklee College of Music Csound development team                */

#include "csoundCore.h"
#include "cmath.h"
#include <math.h>

int ipow(CSOUND *csound, POW *p)        /*      Power for i-rate */
{
    MYFLT in = *p->in;
    MYFLT powerOf = *p->powerOf;
    if (UNLIKELY(in == FL(0.0) && powerOf == FL(0.0)))
      return csound->PerfError(csound, Str("NaN in pow\n"));
    else if (*p->norm!=FL(0.0))
      *p->sr = POWER(in, powerOf) / *p->norm;
    else 
      *p->sr = POWER(in, powerOf);
    return OK;
}

int apow(CSOUND *csound, POW *p)        /* Power routine for a-rate  */
{
    int   n, nsmps = csound->ksmps;
    MYFLT *in = p->in, *out = p->sr;
    MYFLT powerOf = *p->powerOf;
    MYFLT norm = *p->norm;
    if (norm==FL(0.0)) norm = FL(1.0);
    if (UNLIKELY(powerOf == FL(0.0))) {
      MYFLT yy = FL(1.0) / *p->norm;
      for (n = 0; n < nsmps; n++) {
        MYFLT xx = in[n];
        if (UNLIKELY(xx == FL(0.0))) {
          return csound->PerfError(csound, Str("NaN in pow\n"));
        }
        else
          out[n] = yy;
      }<commit_msg>Patching pow in new parser<commit_after>/*
    cmath.c:

    Copyright (C) 1994 <NAME>, <NAME>

    This file is part of Csound.

    The Csound Library is free software; you can redistribute it
    and/or modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    Csound is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Csound; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA
*/

/*      Math functions for Csound coded by <NAME> 1994         */
/*      Berklee College of Music Csound development team                */

#include "csoundCore.h"
#include "cmath.h"
#include <math.h>

int ipow(CSOUND *csound, POW *p)        /*      Power for i-rate */
{
    MYFLT in = *p->in;
    MYFLT powerOf = *p->powerOf;
    if (UNLIKELY(in == FL(0.0) && powerOf == FL(0.0)))
      return csound->PerfError(csound, Str("NaN in pow\n"));
    else if (p->norm!=NULL)
      *p->sr = POWER(in, powerOf) / *p->norm;
    else 
      *p->sr = POWER(in, powerOf);
    return OK;
}

int apow(CSOUND *csound, POW *p)        /* Power routine for a-rate  */
{
    int   n, nsmps = csound->ksmps;
    MYFLT *in = p->in, *out = p->sr;
    MYFLT powerOf = *p->powerOf;
    MYFLT norm = (p->norm!=NULL ? *p->norm : FL(1.0));
    if (norm==FL(0.0)) norm = FL(1.0);
    if (UNLIKELY(powerOf == FL(0.0))) {
      MYFLT yy = FL(1.0) / *p->norm;
      for (n = 0; n < nsmps; n++) {
        MYFLT xx = in[n];
        if (UNLIKELY(xx == FL(0.0))) {
          return csound->PerfError(csound, Str("NaN in pow\n"));
        }
        else
          out[n] = yy;
      }
{'fraction_non_alphanumeric': 0.12478206724782068, 'fraction_numerical': 0.02042341220423412, 'mean_word_length': 2.3691275167785233, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 40, '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': '2913098', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1351, 'n_words': 488}