public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/18099] New: Incorrect rounding from floating point to integer
@ 2004-10-21 17:01 bosch at gcc dot gnu dot org
2004-10-21 17:04 ` [Bug ada/18099] " bosch at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: bosch at gcc dot gnu dot org @ 2004-10-21 17:01 UTC (permalink / raw)
To: gcc-bugs
Ada requires conversion of floating-point to integer to round, with halfway cases rounded away from
zero. This is implemented by adding 0.5 to the floating-point value and then truncating, as in regular C
float to int conversion. However, this gives wrong semantics for the predecessor of 0.5, and odd
floating-point integers in the range 2.0**(mantissa - 1)+1.0 .. 2.0**(mantissa)-1.0 and the negative
versions of these.
The reason is that adding 0.5 in the above cases, yields a value exactly between two
representable floating-point numbers. So the predecessor of 0.5 is then rounded to one, and the
floating-point integers mentioned before get rounded to the next higher integer.
I'll file a self-contained test case testing these cases.
--
Summary: Incorrect rounding from floating point to integer
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: ada
AssignedTo: bosch at gcc dot gnu dot org
ReportedBy: bosch at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18099
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/18099] Incorrect rounding from floating point to integer
2004-10-21 17:01 [Bug ada/18099] New: Incorrect rounding from floating point to integer bosch at gcc dot gnu dot org
@ 2004-10-21 17:04 ` bosch at gcc dot gnu dot org
2004-10-21 17:06 ` bosch at gcc dot gnu dot org
2005-02-24 22:37 ` bosch at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bosch at gcc dot gnu dot org @ 2004-10-21 17:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bosch at gcc dot gnu dot org 2004-10-21 17:04 -------
Created an attachment (id=7396)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7396&action=view)
Test case showing failure
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18099
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/18099] Incorrect rounding from floating point to integer
2004-10-21 17:01 [Bug ada/18099] New: Incorrect rounding from floating point to integer bosch at gcc dot gnu dot org
2004-10-21 17:04 ` [Bug ada/18099] " bosch at gcc dot gnu dot org
@ 2004-10-21 17:06 ` bosch at gcc dot gnu dot org
2005-02-24 22:37 ` bosch at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bosch at gcc dot gnu dot org @ 2004-10-21 17:06 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-10-21 17:06:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18099
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/18099] Incorrect rounding from floating point to integer
2004-10-21 17:01 [Bug ada/18099] New: Incorrect rounding from floating point to integer bosch at gcc dot gnu dot org
2004-10-21 17:04 ` [Bug ada/18099] " bosch at gcc dot gnu dot org
2004-10-21 17:06 ` bosch at gcc dot gnu dot org
@ 2005-02-24 22:37 ` bosch at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bosch at gcc dot gnu dot org @ 2005-02-24 22:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bosch at gcc dot gnu dot org 2005-02-24 18:12 -------
The fix for this is now in GCC 4.0.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18099
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-02-24 18:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 17:01 [Bug ada/18099] New: Incorrect rounding from floating point to integer bosch at gcc dot gnu dot org
2004-10-21 17:04 ` [Bug ada/18099] " bosch at gcc dot gnu dot org
2004-10-21 17:06 ` bosch at gcc dot gnu dot org
2005-02-24 22:37 ` bosch at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).