www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/11/09:21:44

From: "Tanes Sriviroolchai" <Tanes DOT Sriviroolchai AT Thailand DOT NCR DOT COM>
Newsgroups: comp.os.msdos.djgpp
Subject: Weird results of log( -1.0 ) with libm.a and without libm.a
Date: Thu, 11 Jan 2001 16:49:21 +0700
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Original-NNTP-Posting-Host: 192.127.136.173
Message-ID: <3a5d81c9@rpc1284.daytonoh.ncr.com>
X-Original-Trace: 11 Jan 2001 04:50:01 -0500, 192.127.136.173
NNTP-Posting-Host: ncrnews.daytonoh.ncr.com
X-Trace: 11 Jan 2001 09:20:17 -0500, ncrnews.daytonoh.ncr.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 <stdio.h>
#include <math.h>

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



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019