Date: Thu, 11 Jan 2001 19:25:04 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp-workers AT delorie DOT com Subject: Weird results of log( -1.0 ) with libm.a and without libm.a (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Someone complained about log() from libm producing -Inf for a negative argument. It turns out that this is what the code is supposed to do, and it is even documented in libm.info (type "info libm log"). Does anyone has an idea why this is the Right Thing to do? ---------- Forwarded message ---------- Date: Thu, 11 Jan 2001 16:49:21 +0700 From: Tanes Sriviroolchai To: djgpp AT delorie DOT com Newgroups: comp.os.msdos.djgpp Subject: Weird results of log( -1.0 ) with libm.a and without libm.a Hi, I'm currently using DJGPP 2.03, gcc 2.95.2. The following short program gives the different result when using libm.a and when not using libm.a. #include #include main() { double y; y = log( -1.0 ); printf( "%f\n", y ); return 0; } gcc -o test1.exe test1.c when running you will get NaN This is expected result. However if I compile using gcc -o test1.exe test1.c -lm and then running, you will get -Inf Is there a report of this error before? Regards, Tanes Sriviroolchai