openlibm icon indicating copy to clipboard operation
openlibm copied to clipboard

Non-standard behavior of tgamma()

Open Agonisia opened this issue 6 months ago • 0 comments

Observed non-standard behavior when testing tgamma(). Currently, the tgamma() function implementation has an inconsistency with error handling.

Reference Link

Errors are reported as specified in math_errhandling.
For IEEE-compatible type double, overflow happens if 0 < x < 1/[DBL_MAX] or if x > 171.7.  
  
If a range error due to overflow occurs, [±HUGE_VAL], ±HUGE_VALF, or ±HUGE_VALL is returned.
POSIX requires that a pole error occurs if the argument is zero, but a domain error occurs when the argument is a negative integer

Specifically, it fails to set errno to either ERANGE (for overflow cases) or EDOM (when the input parameter is a negative integer), as required by standard.

Agonisia avatar May 19 '25 21:05 Agonisia