ceiling(x): Integer Ceiling

Integer ceiling function

Declaración

Sintaxis

retval = ceiling(x)
elemental integer function ceiling(x)

Argumentos

The input value x may be of type real or integer.

Valores devueltos

The return value is of type integer and nearest greater integer.

Descripción

ceiling(x) returns the least integer greater than or equal to x.

Tipos

Supported input parameter types are integer and real.

interface ceiling
    module procedure sceiling, dceiling
end interface

contains

elemental integer function sceiling(x)
real(sp), intent(in) :: x
end function

elemental integer function dceiling(x)
real(dp), intent(in) :: x
end function

Ejemplos

program intrinsics_ceiling
   implicit none
   real :: x = 63.29
   print *, ceiling(x)
   print *, ceiling(-63.29)
end program

Result:

64
-63

Ver también

floor, mod.