File: intrinsics_31.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (26 lines) | stat: -rw-r--r-- 634 bytes parent folder | download
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
program intrinsics_31
    real :: x = 63.29
    real :: y = -63.59
    
    integer, parameter :: dp = kind(0.d0)
    real(dp) :: z = 0.000001_dp
    real(dp) :: w = -1.000001_dp

    real :: x_ceil, y_ceil
    integer :: z_ceil, w_ceil
    
    x_ceil = ceiling(x)
    y_ceil = ceiling(y)
    z_ceil = ceiling(z)
    w_ceil = ceiling(w)

    if (abs(x_ceil - 64) > 1e-5) error stop
    if (abs(y_ceil - (-63)) > 1e-5) error stop
    if(z_ceil /= 1) error stop
    if(w_ceil /= -1) error stop

    print *, x_ceil, ceiling(x_ceil)
    print *, y_ceil, ceiling(y_ceil)
    print *, z_ceil
    print *, w_ceil
end program intrinsics_31