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