boostorg / boostorg/multiprecision
tgamma overflows with half-integer arguments
- Dominant language
- C++
- Stars
- 265
- Forks
- 128
- Avg merge
- 4h 48m
- Merged PRs (30d)
- 2
Description
The following MRE illustrates that tgamma overflows (i.e. returns infinity) when half-integers are used:
```
using namespace boost::multiprecision;
typedef number::digits, backends::digit_base_2, void, boost::int16_t, -1022, 1023>, et_off> float8x;
long double t = 3.5l;
float8x tt = 3.5l;
long double r = tgamma(t);
long double rr = (long double) tgamma(tt);
```
Produces 3.32335097044784255117 for `r`, but infinity for `rr`. In contrast:
```
float8x tt = 3.l;
long double rr = (long double) tgamma(tt);
```
Produces the correct value of 2.
(g++ 8.3.0 on Linux, `long double` is 80bit extended)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by compiling the provided minimal reproduction with the cpp_bin_float configuration and compare tgamma for 3.5 and 3.0 against long double. Trace the tgamma path used for half-integer cpp_bin_float values, then verify that the 3.5 result is finite and matches the reference behavior without regressing the 3.0 case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100