Skip to content

Commit

Permalink
Add new procedure binary64-fused-multiply-add
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Dec 11, 2024
1 parent 0208039 commit 917e3c5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.289.so` and executable `meevax`.
| `all` | Build shared-library `libmeevax.0.5.290.so` and executable `meevax`.
| `install` | Copy files into `/usr/local` directly.
| `package` | Generate debian package `meevax_0.5.289_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.289_amd64.deb`.
| `package` | Generate debian package `meevax_0.5.290_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.290_amd64.deb`.
| `test` | Test executable `meevax`. This target requires Valgrind to be installed.
| `uninstall` | Remove files copied to `/usr/local` directly by target `install`.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.289
0.5.290
17 changes: 15 additions & 2 deletions basis/srfi-144.ss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
binary64-epsilon
binary64-exponent
binary64-fractional-part
binary64-fused-multiply-add
binary64-greatest
binary64-integer-log-binary
binary64-integral-part
Expand All @@ -29,6 +30,8 @@
)
(only (scheme base)
*
+
-
/
<
<=
Expand Down Expand Up @@ -79,8 +82,8 @@
flpositive? flnegative? flodd? fleven? flfinite? flinfinite? flnan?
flnormalized? fldenormalized?

flmax flmin
; fl+ fl* fl+* fl- fl/ flabs flabsdiff
flmax flmin fl+ fl* fl+* fl- fl/
; flabs flabsdiff
; flposdiff flsgn flnumerator fldenominator
; flfloor flceiling flround fltruncate
;
Expand Down Expand Up @@ -252,5 +255,15 @@
(define flmax binary64-max)

(define flmin binary64-min)

(define fl+ +)

(define fl* *)

(define fl+* binary64-fused-multiply-add)

(define fl- -)

(define fl/ /)
)
)
5 changes: 5 additions & 0 deletions src/kernel/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,11 @@ namespace meevax::inline kernel

return make(min);
});

library.define<procedure>("binary64-fused-multiply-add", [](let const& xs)
{
return make(std::fma(car(xs).as<double>(), cadr(xs).as<double>(), caddr(xs).as<double>()));
});
});

define<library>("(meevax list)", [](library & library)
Expand Down
12 changes: 11 additions & 1 deletion test/srfi-144.ss
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@

(check (flmin -1.0 0.0 1.0) => -1.0)

(check (procedure? fl+) => #t)

(check (procedure? fl*) => #t)

(check (fl+* 2.0 3.0 4.0) => 10.0)

(check (procedure? fl-) => #t)

(check (procedure? fl/) => #t)

(check-report)

(exit (check-passed? 96))
(exit (check-passed? 101))

0 comments on commit 917e3c5

Please sign in to comment.