Ceil v0.1.0
Rounds up to the nearest integer value.
Package: Math
Signature
func Ceil(x: float64) -> float64;
func Ceil(x: float32) -> float32;
Parameters
| Name | Type | Description |
|---|---|---|
x | float64 / float32 | The value to round. |
Returns
The smallest integer value at or above x, still represented as a
floating-point number. Ceil(-0.5) is -0.0 rather than 0.0 — truncation
carries the sign of x across, and IEEE-754 asks for that sign to survive. A
NaN passes through unchanged.
Example
import Math::Ceil;
func Main() -> int {
let a = Ceil(3.2); // 4.0
let b = Ceil(-3.7); // -3.0
return 0;
}