feat(sterni/nix): add trivial float library
Only implements the different conversion types from and to ints for now.
Unfortunately very reliant on builtins.{floor,ceil} which can't be
implemented purely except very inefficiently (to my knowledge), so it
only really works for C++ Nix >= 2.4. Tests are thus skipped for
C++ Nix 2.3.
Change-Id: Idcb1a11df11e214cdba3f2a0715472b370daa7dc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9008
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
parent
984ea69386
commit
55a3b3eb81
3 changed files with 73 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ rec {
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue