This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Implement -fsanitize=float-cast-overflow
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 15 May 2014 21:29:44 +0000
- Subject: Re: [PATCH] Implement -fsanitize=float-cast-overflow
- Authentication-results: sourceware.org; auth=none
- References: <20140513170801 dot GG2663 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1405131745570 dot 23277 at digraph dot polyomino dot org dot uk> <20140514113839 dot GE10386 at tucnak dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1405141727440 dot 16785 at digraph dot polyomino dot org dot uk> <20140515190929 dot GQ10386 at tucnak dot redhat dot com>
On Thu, 15 May 2014, Jakub Jelinek wrote:
> But I think we can't use decimal_real_from_string, we'd need a variant
> of that function that would allow specification of the rounding mode
My point is that you can use "%.*RUe" or "%.*RDe" formats (for max and min
respectively), with an appropriate precision, and let MPFR do the rounding
to an appropriate number of decimal digits in the right direction (to
produce a value that's exactly representable in the relevant DFP type, as
long as it's in range).
--
Joseph S. Myers
joseph@codesourcery.com