Category talk:Wren-i64: Difference between revisions
→Source code (Wren): Bug fix
(→Source code (Wren): Added largestPrime and prev{rime) |
(→Source code (Wren): Bug fix) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 28:
==Source code (Wren)==
<syntaxhighlight lang="
import "./trait" for Comparable
Line 360:
copy() { I64.from(this) } // copies 'this' to a new I64 object
isOdd { this % I64.two
isEven { this % I64.two == I64.zero } // true if 'this' is even
isZero { this == I64.zero } // true if 'this' is zero
Line 1,112:
return 0
}
// Return a list of the current instance's base 10 digits
digits { toString.map { |d| Num.fromString(d) }.toList }
digitSum {
var sum = 0
for (d in toString.bytes) sum = sum + d - 48
return sum
}
}
|