Category talk:Wren-rat: Difference between revisions

Content added Content deleted
(→‎Source code: Harmonization of constants between numeric modules.)
(→‎Source code: Added roundUp method.)
Line 158: Line 158:
truncate { Rat.fromInt(toFloat.truncate) } // lower integer, towards zero
truncate { Rat.fromInt(toFloat.truncate) } // lower integer, towards zero
round { Rat.fromInt(toFloat.round) } // nearer integer
round { Rat.fromInt(toFloat.round) } // nearer integer
roundUp { this >= 0 ? ceil : floor } // higher integer, away from zero
fraction { this - truncate } // fractional part (same sign as this.num)
fraction { this - truncate } // fractional part (same sign as this.num)