mirror of
https://github.com/NixOS/nix
synced 2025-07-09 07:53:55 +02:00
Merge pull request #4787 from Ma27/builtins-ceil-floor
Implement `builtins.floor` and `builtins.ceil` using the C library functions internally
This commit is contained in:
commit
8768398d5f
3 changed files with 50 additions and 0 deletions
1
tests/lang/eval-okay-floor-ceil.exp
Normal file
1
tests/lang/eval-okay-floor-ceil.exp
Normal file
|
@ -0,0 +1 @@
|
|||
"23;24;23;23"
|
9
tests/lang/eval-okay-floor-ceil.nix
Normal file
9
tests/lang/eval-okay-floor-ceil.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
with import ./lib.nix;
|
||||
|
||||
let
|
||||
n1 = builtins.floor 23.5;
|
||||
n2 = builtins.ceil 23.5;
|
||||
n3 = builtins.floor 23;
|
||||
n4 = builtins.ceil 23;
|
||||
in
|
||||
builtins.concatStringsSep ";" (map toString [ n1 n2 n3 n4 ])
|
Loading…
Add table
Add a link
Reference in a new issue