diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2021-05-10 11:47:00 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2021-05-10 12:19:32 +0200 |
commit | 7f7f99f3505ba9bc3d330fe32d3e697a2ad45446 (patch) | |
tree | ff060f1723647aaf8dc46a09c5b5c3e15f6f5e2f /tests/lang | |
parent | db6ab75caec3ea4f575d7a01a28fd1fd7bc28892 (diff) |
Implement `builtins.floor` and `builtins.ceil` using the C library functions internally
Closes #4782
Note: even though the type is internally called `NixFloat`, it's
actually a `double`.
Diffstat (limited to 'tests/lang')
-rw-r--r-- | tests/lang/eval-okay-floor-ceil.exp | 1 | ||||
-rw-r--r-- | tests/lang/eval-okay-floor-ceil.nix | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-floor-ceil.exp b/tests/lang/eval-okay-floor-ceil.exp new file mode 100644 index 000000000..81f80420b --- /dev/null +++ b/tests/lang/eval-okay-floor-ceil.exp @@ -0,0 +1 @@ +"23;24;23;23" diff --git a/tests/lang/eval-okay-floor-ceil.nix b/tests/lang/eval-okay-floor-ceil.nix new file mode 100644 index 000000000..d76a0d86e --- /dev/null +++ b/tests/lang/eval-okay-floor-ceil.nix @@ -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 ]) |