Skip to content

Commit

Permalink
Add new free function is_inexact
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Oct 2, 2023
1 parent d450893 commit a49c8ec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.7
0.5.8
2 changes: 2 additions & 0 deletions include/meevax/kernel/number.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/kernel/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ inline namespace kernel
return is_exact(xs[0]);
});

library.define<predicate>("inexact?", [](let const& xs)
{
return is_inexact(xs[0]);
});

library.define<predicate>("exact-integer?", [](let const& xs)
{
return xs[0].is<exact_integer>();
Expand Down
5 changes: 5 additions & 0 deletions src/kernel/number.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a49c8ec

Please sign in to comment.