Date: Thu, 14 Jan 1999 15:45:55 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp-workers AT delorie DOT com Subject: What should libm functions return for bad args Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com My attention was drawn to this because the Gawk test suite fails for two functions built into Awk: exp and log. It turns out that Gawk test suite expects to see certain return values for arguments that cause SING, DOMAIN, and other errors; for example log(-1) is expected to return NaN, log(0) should produce -Inf, etc. Tt also expects to see the "log: SING error" and similar messages in these cases. The trouble is, our libm supports either one of these requirements, but not both: if you request the _SVID_ behavior, which is the only one that causes the "SING error" messages to be printed, then Inf and NaN are never returned; instead, the library replaces them with +/- FLT_MAX. The default setup (in v2.02) does return Inf and NaN, but there's no messages (as matherr is not called). (If the above doesn't make sense to you, see "info libc alpha libm" in v2.02's libc.info, and the file src/libm/math/k_standard.c in djlsr202.zip.) I'm quite sure the people who wrote fdlibm (from which our libm is derived) didn't just invent this behavior. But before I ask Gawk developers to revise their test suite, I'd like to have some evidence from other platforms. So please try the following two Awk commands on as many Unix/Linux platforms as you can gain access and tell me what do they print: awk 'BEGIN { print log(0), log(-1), log(100) }' awk 'BEGIN { print exp(0), exp(1000000), exp(0.5) }' If Gawk is installed on the target system, try Gawk; if not, try Awk. Thanks in advance.