public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it
@ 2014-04-01 15:44 georggcc at googlemail dot com
  2014-04-01 15:46 ` [Bug ada/60730] " georggcc at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: georggcc at googlemail dot com @ 2014-04-01 15:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60730

            Bug ID: 60730
           Summary: 'Round of a fixed point type incorrectly truncates its
                    operand instead of rounding it
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: georggcc at googlemail dot com

Created attachment 32517
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32517&action=edit
full program text

The program below raises, but should not; LRM 3.5.10 says
that Centi'Round should round away from 0 in the case
presented here.

The program attached to this report tries to reflect the
discussion in comp.lang.ada that started on 22nd of Jan 2014,
"How to round to the nearest fixed-point value".
The effect seen has been classified as a compiler bug: the
program should run as is, with no output. Instead, it raises
Program_Error because the value of 0.999, supposedly
rounded to 3 digits in `Rounded`, is not 1.00, but 0.99. 

$ gnatmake -gnatv -gnatwa round_decimal
gcc -c -gnatv -gnatwa round_decimal.adb

GNAT 4.9.0 20140331 (experimental)
Copyright 1992-2014, Free Software Foundation, Inc.

Compiling: round_decimal.adb (source file time stamp: 2014-04-01 15:39:04)
 38 lines: No errors
gnatbind -x round_decimal.ali
gnatlink round_decimal.ali

$ ./round_decimal 

raised PROGRAM_ERROR : round_decimal.adb:35 explicit raise


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-11 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-01 15:44 [Bug ada/60730] New: 'Round of a fixed point type incorrectly truncates its operand instead of rounding it georggcc at googlemail dot com
2014-04-01 15:46 ` [Bug ada/60730] " georggcc at googlemail dot com
2014-04-11 13:59 ` georggcc at googlemail dot com
2014-04-11 16:41 ` gnugcc at marino dot st

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).