This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/3475: fabs == identity (i.e. fabs broken)
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3475: fabs == identity (i.e. fabs broken)
- From: ak at ixion dot net
- Date: 29 Jun 2001 10:45:33 -0000
>Number: 3475
>Category: c++
>Synopsis: fabs == identity (i.e. fabs broken)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Jun 29 03:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: ak@ixion.net
>Release: 3.0
>Organization:
iXiONmedia
>Environment:
System: Linux dendrite 2.4.4 #4 Don Mai 3 00:14:41 CEST 2001 i586 unknown
Architecture: i586
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ./configure --prefix=/opt/gcc-3.0/
>Description:
fabs.c ------------------------------------------------------------------------
#include <math.h>
#include <stdio.h>
int main() {
double u = -5;
printf("%lf\n",fabs(u));
}
-------------------------------------------------------------------------------
compiling this program results (correctly) in "5.0000" when compiled with
gcc fabs.c -o fabs
and (incorrectly) in "-5.00000" when compiled with
g++ fabs.c -o fabs
>How-To-Repeat:
>Fix:
write your own code for fabs
>Release-Note:
>Audit-Trail:
>Unformatted: