https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93567

jvdelisle at charter dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at charter dot net

--- Comment #6 from jvdelisle at charter dot net ---
(In reply to Dominique d'Humieres from comment #4)
> The patch in comment 3 broke gfortran.dg/round_3.f08.
> 
> The following should work
> 
> --- ../_clean/libgfortran/io/write_float.def  2020-06-13 03:11:55.000000000
> +0200
> +++ libgfortran/io/write_float.def    2020-07-21 00:37:24.000000000 +0200
> @@ -1004,7 +1004,11 @@ determine_en_precision (st_parameter_dt 
>        exp_d = calculate_exp_ ## x (d);\
>        r_sc = (1 - r / exp_d);\
>        temp = 0.1 * r_sc;\
> -      if ((m > 0.0 && ((m < temp) || (r >= (exp_d - m))))\
> +      if ((m > 0.0 && ((m < temp) || (r == 0.5 && r >= (exp_d - m))\
> +                               || (r == 1 && !sign_bit && 1 > (exp_d - m))\
> +                               || (r == 1 && sign_bit && 0 >= (exp_d - m))\
> +                               || (r == 0 && !sign_bit && 0 >= (exp_d - m))\
> +                               || (r ==0 && sign_bit && 1 > (exp_d - m))))\
                                          ^
>         || ((m == 0.0) && !(compile_options.allow_std\
>                             & (GFC_STD_F2003 | GFC_STD_F2008)))\
>         ||  d == 0)\

It gets complicated quickly with all the corner cases.  Lat line of the added
logic needs a space before the 0

Reply via email to