From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 30A3B3858D35; Tue, 6 Feb 2024 00:48:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30A3B3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707180507; bh=MgiavbT98O71YinzL3LEXoH9kxhf/zy7uU5sWvR71Kw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lC0J3jj03mMDtNK3z1Qq7ONzE90L3/oh0X0tWGmaZtFMN/hGBEfMLiSS8ytxBZNKy BxRv1JAP/izUflxEH10O+XuRo4/zl8Bu89oOs7TsYvI2r92j8zbDKtwmEczQ5qKASG ZT+rQ1UFlaPMJEtxpY35Ba/cxc9zMP8W7bXe/weM= From: "newbie-02 at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113455] ROUNDING: IEEE Standard: Missing decimal rounding mode 'nearest, ties away from zero' for decimalxxx datatypes. Date: Tue, 06 Feb 2024 00:48:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: newbie-02 at gmx dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113455 --- Comment #5 from newbie-02 --- > If you're doing arithmetic with constant operands, it might be folded at = compile time; make sure you're using -frounding-math to avoid that.=20=20 hmmmmm... that issue is left. From your comment I was in hope the following program would work:=20=20 ````=20=20 // compile with 'gcc -std=3Dgnu99 -I/usr/local/include/dfp -frounding-math = -o round_constants_ties_away round_constants_ties_away.c -ldfp',=20 #define __STDC_WANT_DEC_FP__=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 // req. for decimal rounding mode,=20 #include =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 // req. for decimal rounding mode,=20 #include =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 // reg. e.g. printf and perror,=20 int main( int argc, char *argv[ ] ) {=20 fe_dec_setround( 4 );=20 printf( "fe_dec_rounding_mode : %d \n", fe_dec_getround() );=20 volatile _Decimal64 x1DD =3D 8.0000000000000015DD;=20 volatile _Decimal64 x2DD =3D 8.0000000000000025DD;=20 printf( "Read in of 8.0000000000000015 produced : %.17DE \n", x1DD = );=20 printf( "Read in of 8.0000000000000025 produced : %.17DE \n", x2DD = );=20 printf( "In operation it works : %.17DE \n", x2DD + 5E-16DD );=20 return( 0 );=20 }=20 ````=20=20 It works, but doesn't round the constants as wanted:=20=20 ````=20=20 =E2=94=94=E2=94=80$ ./round_constants_ties_away=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 fe_dec_rounding_mode : 4=20 Read in of 8.0000000000000015 produced : 8.00000000000000200E+00=20 Read in of 8.0000000000000025 produced : 8.00000000000000200E+00=20 In operation it works : 8.00000000000000300E+00=20 ````=