1 /* Compute a product of 1 + (T/X), 1 + (T/(X+1)), ....
2 Copyright (C) 2015-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <http://www.gnu.org/licenses/>. */
20 #include <math_private.h>
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
30 __lgamma_productl (long double t
, long double x
, long double x_eps
, int n
)
32 long double x_full
= x
+ x_eps
;
34 for (int i
= 0; i
< n
; i
++)
35 /* FIXME: no extra precision used. */
36 ret
+= (t
/ (x_full
+ i
)) * (1 + ret
);