ceiling(x): Integer Ceiling

Integer ceiling function

Declaration

Sintaxe

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

Argumentos

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

Valores de retorno

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

Descrição

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

Exemplos

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

Resultado:

64
-63

Veja Também

floor, mod.