From e99ca9d86aa7d3494e11a7cf28a3e30b85ee4d02 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Sat, 7 Dec 2024 21:57:21 +0900 Subject: [PATCH] Add new procedure `copy-sign` Signed-off-by: yamacir-kit --- README.md | 4 ++-- VERSION | 2 +- basis/srfi-144.ss | 3 +++ include/meevax/kernel/number.hpp | 2 ++ src/kernel/boot.cpp | 5 +++++ src/kernel/number.cpp | 1 + 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 559f0fdad..16ceb0bc2 100644 --- a/README.md +++ b/README.md @@ -97,9 +97,9 @@ Then, select one of the following targets and `make` it according to your purpos | Target | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.277.so` and executable `meevax`. +| `all` | Build shared-library `libmeevax.0.5.278.so` and executable `meevax`. | `install` | Copy files into `/usr/local` directly. -| `package` | Generate debian package `meevax_0.5.277_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.277_amd64.deb`. +| `package` | Generate debian package `meevax_0.5.278_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.278_amd64.deb`. | `test` | Test executable `meevax`. This target requires Valgrind to be installed. | `uninstall` | Remove files copied to `/usr/local` directly by target `install`. diff --git a/VERSION b/VERSION index c19651393..174b337b4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.277 +0.5.278 diff --git a/basis/srfi-144.ss b/basis/srfi-144.ss index 94384de3c..1ccf56b84 100644 --- a/basis/srfi-144.ss +++ b/basis/srfi-144.ss @@ -6,6 +6,7 @@ binary64-epsilon binary64-max binary64-min + copy-sign e euler gamma @@ -157,5 +158,7 @@ (define flonum inexact) (define fladjacent next-after) + + (define flcopysign copy-sign) ) ) diff --git a/include/meevax/kernel/number.hpp b/include/meevax/kernel/number.hpp index 2695ef286..a0ef6b902 100644 --- a/include/meevax/kernel/number.hpp +++ b/include/meevax/kernel/number.hpp @@ -404,6 +404,8 @@ inline namespace number auto next_after(object const&, object const&) -> object; + auto copy_sign(object const&, object const&) -> object; + auto number_to_string(object const&, int) -> object; } // namespace number } // namespace kernel diff --git a/src/kernel/boot.cpp b/src/kernel/boot.cpp index bdbb1c242..314ae36e5 100644 --- a/src/kernel/boot.cpp +++ b/src/kernel/boot.cpp @@ -560,6 +560,11 @@ namespace meevax::inline kernel return next_after(car(xs), cadr(xs)); }); + library.define("copy-sign", [](let const& xs) + { + return copy_sign(car(xs), cadr(xs)); + }); + library.define("e", std::numbers::e); library.define("pi", std::numbers::pi); diff --git a/src/kernel/number.cpp b/src/kernel/number.cpp index 1774042cc..f5a147465 100644 --- a/src/kernel/number.cpp +++ b/src/kernel/number.cpp @@ -987,6 +987,7 @@ inline namespace number } DEFINE_REAL_BINARY(atan, std::atan2) + DEFINE_REAL_BINARY(copy_sign, std::copysign) DEFINE_REAL_BINARY(next_after, std::nextafter) auto number_to_string(object const& x, int radix) -> object