KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Floor and Ceiling functions in 4D
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: November 25, 2009
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Floor and Ceiling math functions can be easily created with the Int command. Floor and ceiling functions find the next smallest or largest integer from a real value.

Definitions and examples:

  • Floor function: Returns the next smallest integer.

    C_REAL($1)
    C_LONGINT($0)

    $0:=Int($1)

  • Ceiling function: Returns the next largest integer.

    C_REAL($1)
    C_LONGINT($0)

    If(Int($1)=$1)
      $0:=Int($1)
    Else
      $0:=Int($1)+1
    End If