Document: WG14 N1357
Submitter: Fred Tydeman (USA)
Submission Date: 2009-02-06
Subject: tgamma range error
The following came about as the result of discussions in the Open Group (POSIX).
In effect, for non-integers, tgamma(+/-large) is the same as exp(+/-large). So, tgamma should have: A range error occurs if the magnitude of x is too large.
But, for numbers near zero, tgamma(+/-small), overflow might happen [depends upon range of positive exponents versus range of negative exponents].
ASIDE:
There are two suggested ways to improve the C99 standard:
First way:
In 7.12.8.4 The tgamma functions, paragraph 2, change "A range error may occur if the magnitude of _x_ is too large or too small" to "A range error occurs if the magnitude of x is too large. A range error may occur if the magnitude of _x_ is too small."
Second way:
Add a footnote to 7.12.8.4 The tgamma functions, paragraph 2, the sentence about range error:
For large positive _x_ values, overflow happens.
For signed _x_ values very close to zero, overflow may happen [depends if 1/max is underflow or 1/min is overflow; that is, if negative exponents are larger in magnitude than positive exponents].
For large negative _x_ non-integer values, underflow happens.