From a49c8ece3439b01cabb51717452bdffa3861a258 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Tue, 3 Oct 2023 00:52:08 +0900 Subject: [PATCH] Add new free function `is_inexact` Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/number.hpp | 2 ++ src/kernel/boot.cpp | 5 +++++ src/kernel/number.cpp | 5 +++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d2c054188..89291386f 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Procedures for each standard are provided by the following R7RS-style libraries: cmake -B build -DCMAKE_BUILD_TYPE=Release cd build make package -sudo apt install build/meevax_0.5.7_amd64.deb +sudo apt install build/meevax_0.5.8_amd64.deb ``` or @@ -131,9 +131,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.7.so` and executable `meevax` +| `all` | Build shared-library `libmeevax.0.5.8.so` and executable `meevax` | `test` | Test executable `meevax` -| `package` | Generate debian package `meevax_0.5.7_amd64.deb` +| `package` | Generate debian package `meevax_0.5.8_amd64.deb` | `install` | Copy files into `/usr/local` directly ## Usage diff --git a/VERSION b/VERSION index d3532a107..659914ae9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.7 +0.5.8 diff --git a/include/meevax/kernel/number.hpp b/include/meevax/kernel/number.hpp index ed02016c8..cf416a453 100644 --- a/include/meevax/kernel/number.hpp +++ b/include/meevax/kernel/number.hpp @@ -365,6 +365,8 @@ inline namespace number auto is_exact(object const&) -> bool; + auto is_inexact(object const&) -> bool; + auto is_finite(object const&) -> bool; auto is_infinite(object const&) -> bool; diff --git a/src/kernel/boot.cpp b/src/kernel/boot.cpp index 5cc111d01..970a909d4 100644 --- a/src/kernel/boot.cpp +++ b/src/kernel/boot.cpp @@ -545,6 +545,11 @@ inline namespace kernel return is_exact(xs[0]); }); + library.define("inexact?", [](let const& xs) + { + return is_inexact(xs[0]); + }); + library.define("exact-integer?", [](let const& xs) { return xs[0].is(); diff --git a/src/kernel/number.cpp b/src/kernel/number.cpp index 4f24a7d8f..bd4c91cac 100644 --- a/src/kernel/number.cpp +++ b/src/kernel/number.cpp @@ -678,6 +678,11 @@ inline namespace number return test(f, x); } + auto is_inexact(object const& x) -> bool + { + return not is_exact(x); + } + auto is_finite(object const& x) -> bool { return not is_infinite(x);