From mboxrd@z Thu Jan 1 00:00:00 1970 From: ak@ixion.net To: gcc-gnats@gcc.gnu.org Subject: c++/3475: fabs == identity (i.e. fabs broken) Date: Fri, 29 Jun 2001 03:46:00 -0000 Message-id: <20010629104533.547.qmail@ixion.net> X-SW-Source: 2001-06/msg01174.html List-Id: >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 #include 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: