JuliaMath / JuliaMath/openlibm

Non-standard behavior of tgamma()

Open
#325 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
632
Forks
163
Avg merge
4m
Merged PRs (30d)
1

Description

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

[Reference Link](https://en.cppreference.com/w/c/numeric/math/tgamma)

```
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.