Documentation Language: Swift

Function

ceiling(_:)

Returns the ceiling (smallest integer not smaller than the input) of a real value.

func ceiling(_ value: any EcoreValue) throws -> EInt

Parameters

value

The Real value to compute ceiling for

Return Value

The ceiling value as an Integer

Discussion

Computes the ceiling as defined in OCL specification: “The smallest integer that is not less than self.” Only accepts Real (Float, Double, BigDecimal) values as per OCL standard.

Examples

let result1 = try ceiling(3.2 as EDouble)   // Result: 4
let result2 = try ceiling(-2.7 as EDouble)  // Result: -2
let result3 = try ceiling(5.0 as EDouble)   // Result: 5