PING! Re: [PATCH, Fortran] Extension: COTAN and degree-valued trig intrinsics with -fdec-math

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Oct 11 18:28:00 GMT 2016


On Tue, Oct 11, 2016 at 11:10:13AM -0700, Jerry DeLisle wrote:
> 
> diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
> index bf60f747..18135d2f 100644
> --- a/gcc/fortran/simplify.c
> +++ b/gcc/fortran/simplify.c
> @@ -1768,11 +1768,13 @@ degrees_f (mpfr_t x, mp_rnd_t rnd_mode)
>   static void
>   radians_f (mpfr_t x, mp_rnd_t rnd_mode)
>   {
> -    mpfr_t tmp;
> +    mpfr_t tmp, modtmp;
>       mpfr_init (tmp);
> +    mpfr_init (modtmp);

Delete modtmp.

> 
>       /* Set x = x % 360 to avoid offsets with large angles.  */
> -    mpfr_fmod_d (tmp, x, 360.0, rnd_mode);
> +    mpfr_set_d (modtmp, 360.0, GFC_RND_MODE);

Change this to 

   mpfr_set_ui(tmp, 360, rnd_mode);

> +    mpfr_fmod (tmp, x, modtmp, rnd_mode);

Change this to 

    mpfr_fmod (tmp, x, tmp, rnd_mode);

> 
>       /* Set x = x * pi.  */
>       mpfr_const_pi (tmp, rnd_mode);
> @@ -1782,6 +1784,7 @@ radians_f (mpfr_t x, mp_rnd_t rnd_mode)
>       mpfr_div_d (x, x, 180.0, rnd_mode);
> 
>       mpfr_clear (tmp);
> +    mpfr_clear (modtmp);

Delete this.

>   }

-- 
Steve



More information about the Gcc-patches mailing list