+2016-10-11 Fritz Reese <fritzoreese@gmail.com>
+
+ * iresolve.c (get_radians, get_degrees): Fix sloppy commit.
+ * simplify.c (degrees_f, radians_f): Ditto.
+
2016-10-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* simplify.c (radians_f): Fix mpdr_mod.
/* Set factor = pi / 180. */
factor = gfc_get_constant_expr (deg->ts.type, deg->ts.kind, °->where);
mpfr_const_pi (factor->value.real, GFC_RND_MODE);
- mpfr_div_d (factor->value.real, factor->value.real, 180.0, GFC_RND_MODE);
+ mpfr_div_ui (factor->value.real, factor->value.real, 180, GFC_RND_MODE);
/* Result is rad = (deg % 360) * (pi / 180). */
result = gfc_multiply (result, factor);
/* Set factor = 180 / pi. */
factor = gfc_get_constant_expr (rad->ts.type, rad->ts.kind, &rad->where);
- mpfr_set_d (factor->value.real, 180.0, GFC_RND_MODE);
+ mpfr_set_ui (factor->value.real, 180, GFC_RND_MODE);
mpfr_init (tmp);
mpfr_const_pi (tmp, GFC_RND_MODE);
mpfr_div (factor->value.real, factor->value.real, tmp, GFC_RND_MODE);
mpfr_fmod (tmp, x, tmp, rnd_mode);
/* Set x = x * 180. */
- mpfr_mul_d (x, x, 180.0, rnd_mode);
+ mpfr_mul_ui (x, x, 180, rnd_mode);
/* Set x = x / pi. */
mpfr_const_pi (tmp, rnd_mode);
static void
radians_f (mpfr_t x, mp_rnd_t rnd_mode)
{
- mpfr_t tmp, modtmp;
+ mpfr_t tmp;
mpfr_init (tmp);
- mpfr_init (modtmp);
/* Set x = x % 360 to avoid offsets with large angles. */
- mpfr_set_d (modtmp, 360.0, GFC_RND_MODE);
- mpfr_fmod (tmp, x, modtmp, rnd_mode);
+ mpfr_set_ui (tmp, 360, rnd_mode);
+ mpfr_fmod (tmp, x, tmp, rnd_mode);
/* Set x = x * pi. */
mpfr_const_pi (tmp, rnd_mode);
mpfr_mul (x, x, tmp, rnd_mode);
/* Set x = x / 180. */
- mpfr_div_d (x, x, 180.0, rnd_mode);
+ mpfr_div_ui (x, x, 180, rnd_mode);
mpfr_clear (tmp);
- mpfr_clear (modtmp);
}