This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/3475: fabs == identity (i.e. fabs broken)



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]