Your message dated Thu, 9 May 2013 12:06:18 +0400 with message-id <CAFwitOHDo1d5mTQ54gHUCMT=kZcuZMLBpLt3Qr3oP=c7sbo...@mail.gmail.com> and subject line Float has not enough precision has caused the Debian Bug report #547429, regarding gcc: incorrect code with optimisation to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 547429: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547429 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: gcc Version: 4:4.3.3-9 Severity: normal The code below gives incorrect result for the subtraction when optimisation is used. Without optimisation, the difference is 2. With optimisation, the difference is 0. #include <stdio.h> #include <limits.h> int main(void) { int ii; float ftest; ii=INT_MAX-1; ftest=(float)ii; printf("%d %.11g %.11g\n",ii,ftest,ftest-ii); return 0; } Tested on both gcc 4.3 and 4.4, same error. -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.24 Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages gcc depends on: ii cpp 4:4.3.3-9 The GNU C preprocessor (cpp) ii gcc-4.3 4.3.4-2 The GNU C compiler Versions of packages gcc recommends: ii libc6-dev [libc-dev] 2.9-26 GNU C Library: Development Librari Versions of packages gcc suggests: ii autoconf 2.64-2 automatic configure script builder pn automake1.9 <none> (no description available) ii bison 1:2.4.1.dfsg-3 A parser generator that is compati ii flex 2.5.35-8 A fast lexical analyzer generator. ii gcc-doc 5:2 documentation for the GNU compiler pn gcc-multilib <none> (no description available) ii gdb 6.8.50.20090628-4 The GNU Debugger ii libtool 2.2.6a-4 Generic library support script ii make 3.81-6 An utility for Directing compilati ii manpages-dev 3.22-1 Manual pages about using GNU/Linux -- no debconf information
--- End Message ---
--- Begin Message ---Hello. I try this with gcc-4.3.5-4 and gcc-4.4.5-8. I try -O0, -O1, -O2, -O3 and -Os optimization levels. In every case result was 2147483646 2147483648 0 Float has too little precision - only 23 bits. Whereas int is 32 bits. If you use double result will be correct. #include <stdio.h> #include <limits.h> int main(void) { int ii; double ftest; ii=INT_MAX-1; ftest=(double)ii; printf("%d %.11g %.11g\n",ii,ftest,ftest-ii); return 0; } 2147483646 2147483646 0 Best wishes, Aleksandr
--- End Message ---

