Category talk:Wren-rat: Difference between revisions
m
Minor changes.
(→Source code: Bug fix.) |
m (Minor changes.) |
||
Line 165:
pow(i) {
if (!((i is Num) && i.isInteger)) Fiber.abort("Argument must be an integer.")
if (i == 0) return this.copy()
var np = _n.pow(i).round
var dp = _d.pow(i).round
Line 175:
// Other methods.
inc { this + Rat.one } // increment
dec { this - Rat.one } // decrement
abs { (_n >= 0) ?
sign { _n.sign } // sign
// The inherited 'clone' method just returns 'this' as Rat objects are immutable.
|