aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90
blob: ff4e834a0429e19e1fc78b57b05b6ab359911af8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do run }

  ! Test IEEE_GET_ROUNDING_MODE and IEEE_SET_ROUNDING_MODE
  ! with a RADIX argument
  use, intrinsic :: ieee_arithmetic
  implicit none

  real :: sx1
  type(ieee_round_type) :: r

  if (ieee_support_rounding(ieee_up, sx1) .and. &
      ieee_support_rounding(ieee_down, sx1)) then

    call ieee_set_rounding_mode(ieee_up)
    call ieee_get_rounding_mode(r)
    if (r /= ieee_up) stop 1

    call ieee_set_rounding_mode(ieee_down, radix=2)
    call ieee_get_rounding_mode(r, radix=2)
    if (r /= ieee_down) stop 2

    call ieee_set_rounding_mode(ieee_up, radix=10)
    call ieee_get_rounding_mode(r, radix=2)
    if (r /= ieee_down) stop 3
  end if

end