OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [nint_2.f90] - Blame information for rev 327

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 jeremybenn
! Test that NINT gives right results even in corner cases
2
!
3
! PR 31202
4
! http://gcc.gnu.org/ml/fortran/2005-04/msg00139.html
5
!
6
! { dg-do run }
7
! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc*-*-linux* *-*-mingw* } { "-O0" } { "" } }
8
  real(kind=8) :: a
9
  integer(kind=8) :: i1, i2
10
  real :: b
11
  integer :: j1, j2
12
 
13
  a = nearest(0.5_8,-1.0_8)
14
  i2 = nint(nearest(0.5_8,-1.0_8))
15
  i1 = nint(a)
16
  if (i1 /= 0 .or. i2 /= 0) call abort
17
 
18
  a = 0.5_8
19
  i2 = nint(0.5_8)
20
  i1 = nint(a)
21
  if (i1 /= 1 .or. i2 /= 1) call abort
22
 
23
  a = nearest(0.5_8,1.0_8)
24
  i2 = nint(nearest(0.5_8,1.0_8))
25
  i1 = nint(a)
26
  if (i1 /= 1 .or. i2 /= 1) call abort
27
 
28
  b = nearest(0.5,-1.0)
29
  j2 = nint(nearest(0.5,-1.0))
30
  j1 = nint(b)
31
  if (j1 /= 0 .or. j2 /= 0) call abort
32
 
33
  b = 0.5
34
  j2 = nint(0.5)
35
  j1 = nint(b)
36
  if (j1 /= 1 .or. j2 /= 1) call abort
37
 
38
  b = nearest(0.5,1.0)
39
  j2 = nint(nearest(0.5,1.0))
40
  j1 = nint(b)
41
  if (j1 /= 1 .or. j2 /= 1) call abort
42
 
43
  a = 4503599627370497.0_8
44
  i1 = nint(a,kind=8)
45
  i2 = nint(4503599627370497.0_8,kind=8)
46
  if (i1 /= i2 .or. i1 /= 4503599627370497_8) call abort
47
 
48
  a = -4503599627370497.0_8
49
  i1 = nint(a,kind=8)
50
  i2 = nint(-4503599627370497.0_8,kind=8)
51
  if (i1 /= i2 .or. i1 /= -4503599627370497_8) call abort
52
  end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.