diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/number.lux | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 88cdc4eaf..8c3d08dbf 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -79,6 +79,19 @@ [Real Ord<Real> r.+ r.- r.* r./ r.% r.= r.< 0.0 1.0 -1.0] ) +(struct: #export _ (Number Frac) + (def: ord Ord<Frac>) + (def: + f.+) + (def: - f.-) + (def: * f.*) + (def: / f./) + (def: % f.%) + (def: (negate x) (f.- x (_lux_proc ["frac" "max-value"] []))) + (def: abs id) + (def: (signum x) + (_lux_proc ["frac" "max-value"] [])) + ) + (do-template [<type> <ord> <succ> <pred>] [(struct: #export _ (Enum <type>) (def: ord <ord>) |