view src/build-msvctools/math/acosh.c @ 7225:48e5a8cd5086 default tip @

Qt6: Update to version 6.7.1 * qt6-qtbase.mk: Update version and checksum. Remove no longer recognized configure switch. * qt6-qtbase-1-fixes.patch: Adjust patch for reorganized CMake files. Remove hunk that is no longer needed. * qt6-qtbase-2-6.7.0-opengl-header.patch: Add new patch. * dist-files.mk: Add new file to list. * qt6-qt5compat.mk, qt6-qtimageformats.mk, qt6-qtsvg.mk, qt6-qttools.mk, qt6-qttranslations.mk: Update checksum.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 31 May 2024 10:58:54 +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)) */
double acosh (double x)
{
  if (isnan (x)) 
    return x;

  if (x < 1.0)
    {
      errno = EDOM;
      return nan("");
    }

  if (x > 0x1p32)
    /*  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)));
}