This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/48236] New: uint64_t and int64_t behave differently when converting to float
- From: "juanval at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 Mar 2011 12:58:00 +0000
- Subject: [Bug c/48236] New: uint64_t and int64_t behave differently when converting to float
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48236
Summary: uint64_t and int64_t behave differently when
converting to float
Product: gcc
Version: 4.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: juanval@gmail.com
Created attachment 23749
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23749
Small code to show uint64_t / int64_t difference
Attached code shows a comparison of converted int->float values:
( (float)(ui+1) != ((float)ui) + 1.f )
This comparison fails beginning at number 16777216 for ui of type uint64_t, but
it doesn't fail there for ui of type int64_t.
Tested in gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5), Ubuntu 10.10 32
bits, atom processor.
Compiled with no parameters: gcc test.c && ./a.out
Tested also in mingw 4.4.5, same problem.
Tested in MSVC (vs2010) too, and it doesn't fail early for uint64_t, like gcc
does.