view src/build-msvctools/math/acoshf.c @ 6161:8fcac4d6d983 release

of-queueing: Fix syntax error with Octave 7 (bug #62314). * src/of-queueing-1-octave7.patch: Add new file. * dist-files.mk: Include new patch.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 14 Apr 2022 19:27:13 +0200
parents f8299bb6c872
children
line wrap: on
line source

#include <math.h>
#include <errno.h>
#include "fastmath.h"

/* acosh(x) = log (x + sqrt(x * x - 1)) */
float acoshf (float x)
{
  if (isnan (x)) 
    return x;
  if (x < 1.0f)
    {
      errno = EDOM;
      return nan("");
    }

 if (x > 0x1p32f)
    /*  Avoid overflow (and unnecessary calculation when
        sqrt (x * x - 1) == x). GCC optimizes by replacing
        the long double M_LN2 const with a fldln2 insn.  */ 
    return __fast_log (x) + 6.9314718055994530941723E-1L;

  /* Since  x >= 1, the arg to log will always be greater than
     the fyl2xp1 limit (approx 0.29) so just use logl. */ 
  return __fast_log (x + __fast_sqrt((x + 1.0) * (x - 1.0)));
}