simplify.c (radians_f): Fix mpdr_mod.

2016-10-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* simplify.c (radians_f): Fix mpdr_mod.
	* ireolce.c (get_degrees): Declare tmp.

From-SVN: r241000
This commit is contained in:
Jerry DeLisle 2016-10-11 18:31:50 +00:00
parent 91f2eb13cb
commit e8e5329d0c
3 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2016-10-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* simplify.c (radians_f): Fix mpdr_mod.
* ireolce.c (get_degrees): Declare tmp.
2016-10-11 Fritz Reese <fritzoreese@gmail.com>
* lang.opt: New flag -fdec-math.

View File

@ -2702,6 +2702,7 @@ get_degrees (gfc_expr *rad)
{
gfc_expr *result, *factor;
gfc_actual_arglist *mod_args;
mpfr_t tmp;
gcc_assert (rad->ts.type == BT_REAL);

View File

@ -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);
/* 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);
mpfr_fmod (tmp, x, modtmp, 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);
}