(root)/
glibc-2.38/
sysdeps/
ieee754/
ldbl-128ibm/
lgamma_productl.c
       1  /* Compute a product of 1 + (T/X), 1 + (T/(X+1)), ....
       2     Copyright (C) 2015-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       4  
       5     The GNU C Library is free software; you can redistribute it and/or
       6     modify it under the terms of the GNU Lesser General Public
       7     License as published by the Free Software Foundation; either
       8     version 2.1 of the License, or (at your option) any later version.
       9  
      10     The GNU C Library is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13     Lesser General Public License for more details.
      14  
      15     You should have received a copy of the GNU Lesser General Public
      16     License along with the GNU C Library; if not, see
      17     <https://www.gnu.org/licenses/>.  */
      18  
      19  #include <math.h>
      20  #include <math_private.h>
      21  #include <float.h>
      22  
      23  /* Compute the product of 1 + (T / (X + X_EPS)), 1 + (T / (X + X_EPS +
      24     1)), ..., 1 + (T / (X + X_EPS + N - 1)), minus 1.  X is such that
      25     all the values X + 1, ..., X + N - 1 are exactly representable, and
      26     X_EPS / X is small enough that factors quadratic in it can be
      27     neglected.  */
      28  
      29  long double
      30  __lgamma_productl (long double t, long double x, long double x_eps, int n)
      31  {
      32    long double x_full = x + x_eps;
      33    long double ret = 0;
      34    for (int i = 0; i < n; i++)
      35      /* FIXME: no extra precision used.  */
      36      ret += (t / (x_full + i)) * (1 + ret);
      37    return ret;
      38  }