Category talk:Wren-rat: Difference between revisions
→Source code: Removed type aliases and Rat.maxSafe methods which are no longer needed.
(→Source code: Bug fix - wrong name for toFloat function.) |
(→Source code: Removed type aliases and Rat.maxSafe methods which are no longer needed.) |
||
Line 2:
<lang ecmascript>/* Module "rat.wren" */
import "./trait" for Comparable
/* Rat represents a rational number as an integral numerator and (non-zero) denominator
Line 8:
*/
class Rat is Comparable {
// Private helper function to check that 'o' is a suitable type and throw an error otherwise.
// Numbers and numeric strings are returned as rationals.
Line 222 ⟶ 219:
static max(a) { a.reduce { |acc, x| (x > acc) ? x : acc } }
static min(a) { a.reduce { |acc, x| (x < acc) ? x : acc } }
}</lang>
|