Discussion 解説
The following example shows the results of rounding numbers using this rule: 以下の例は、この規則を使っての数の丸めの結果を示します:
(5.2).rounded(.up)
// 6.0
(5.5).rounded(.up)
// 6.0
(-5.2).rounded(.up)
// -5.0
(-5.5).rounded(.up)
// -5.0
This rule is equivalent to the C ceil
function and implements the round
operation defined by the IEEE 754 specification.
この規則は、C ceil
関数の等価物です、そしてIEEE 754仕様によって定義されるround
演算を実装します。