Re: [pure-lang-users] ln
Status: Beta
Brought to you by:
agraef
From: John C. <co...@cc...> - 2008-08-21 14:30:06
|
Albert Graef scripsit: > Unfortunately, on my Linux system both c_log (1/inf) and c_log (1/-inf) > return -inf in Pure, even though Pure correctly displays 1/inf as 0.0 > and 1/-inf as -0.0. So it seems that the glibc log() function at least > does *not* distinguish between positive and negative zero. Maybe that's > a non-conformance in glibc, I'll have to check POSIX to see whether it > has something to say about log(-0.0). It does, see <http://www.opengroup.org/onlinepubs/000095399/functions/log.html>. Upon successful completion, these functions shall return the natural logarithm of x. If x is ±0, a pole error shall occur and log(), logf(), and logl() shall return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respectively. For finite values of x that are less than 0, or if x is -Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. If x is NaN, a NaN shall be returned. If x is 1, +0 shall be returned. If x is +Inf, x shall be returned. [Option End] The talk of HUGE_VAL is to cover non-IEEE-754 systems that don't have Inf, and have to use the largest representable value as a proxy for it. -- Dream projects long deferred John Cowan <co...@cc...> usually bite the wax tadpole. http://www.ccil.org/~cowan --James Lileks |