diff options
Diffstat (limited to 'users/sterni/nix/num/default.nix')
-rw-r--r-- | users/sterni/nix/num/default.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/users/sterni/nix/num/default.nix b/users/sterni/nix/num/default.nix new file mode 100644 index 000000000000..81e2f8377f3b --- /dev/null +++ b/users/sterni/nix/num/default.nix @@ -0,0 +1,17 @@ +{ ... }: + +rec { + inherit (builtins) + mul + div + add + sub + ; + + sign = i: if i < 0 then -1 else 1; + abs = i: if i < 0 then -i else i; + + inRange = a: b: x: x >= a && x <= b; + + sum = builtins.foldl' (a: b: a + b) 0; +} |