Skip to content

Commit

Permalink
Add procedure binary64-remquo
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 15, 2024
1 parent 13c3ca1 commit 71e2bbe
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 76 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.293.so` and executable `meevax`.
| `all` | Build shared-library `libmeevax.0.5.294.so` and executable `meevax`.
| `install` | Copy files into `/usr/local` directly.
| `package` | Generate debian package `meevax_0.5.293_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.293_amd64.deb`.
| `package` | Generate debian package `meevax_0.5.294_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.294_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.293
0.5.294
76 changes: 68 additions & 8 deletions basis/srfi-144.ss
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@
binary64-min
binary64-normalized-fraction
binary64-normalized?
binary64-remquo
binary64-sign-bit
binary64?
)
(only (meevax inexact)
acosh
asinh
atanh
copy-sign
cosh
e
euler
gamma
load-exponent
next-after
phi
pi
sinh
tanh
)
(only (scheme base)
*
Expand All @@ -42,6 +49,8 @@
>
>=
and
car
cdr
ceiling
define
denominator
Expand All @@ -51,18 +60,25 @@
if
inexact
integer?
lambda
let
negative?
numerator
odd?
or
positive?
quotient
remainder
round
square
truncate
values
zero?
)
(only (scheme inexact)
acos
asin
atan
cos
exp
finite?
Expand All @@ -71,6 +87,7 @@
nan?
sin
sqrt
tan
)
)

Expand All @@ -97,14 +114,13 @@
flnumerator fldenominator flfloor flceiling flround fltruncate

flexp flexp2 flexp-1 flsquare flsqrt flcbrt flhypot flexpt fllog
fllog1+
; fllog2 fllog10 make-fllog-base
;
; flsin flcos fltan flasin flacos flatan
; flsinh flcosh fltanh flasinh flacosh flatanh
;
; flquotient flremainder flremquo
;
fllog1+ fllog2 fllog10 make-fllog-base

flsin flcos fltan flasin flacos flatan flsinh flcosh fltanh flasinh
flacosh flatanh

flquotient flremainder flremquo

; flgamma flloggamma flfirst-bessel flsecond-bessel
; flerf flerfc
)
Expand Down Expand Up @@ -322,5 +338,49 @@
(define fllog log)

(define fllog1+ binary64-log1p)

(define (fllog2 x)
(log x 2))

(define (fllog10 x)
(log x 10))

(define (make-fllog-base b)
(lambda (x)
(log x b)))

(define flsin sin)

(define flcos cos)

(define fltan tan)

(define flasin asin)

(define flacos acos)

(define flatan atan)

(define flsinh sinh)

(define flcosh cosh)

(define fltanh tanh)

(define flasinh asinh)

(define flacosh acosh)

(define flatanh atanh)

(define flquotient quotient)

(define flremainder remainder)

(define (flremquo x y)
(let ((rq (binary64-remquo x y)))
(values (car rq)
(cdr rq))))

)
)
7 changes: 7 additions & 0 deletions src/kernel/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,13 @@ namespace meevax::inline kernel
{
return make(std::log1p(car(xs).as<double>()));
});

library.define<procedure>("binary64-remquo", [](let const& xs)
{
auto quotient = 0;
auto remainder = std::remquo(car(xs).as<double>(), cadr(xs).as<double>(), &quotient);
return cons(make(remainder), make<exact_integer>(quotient));
});
});

define<library>("(meevax list)", [](library & library)
Expand Down
Loading

0 comments on commit 71e2bbe

Please sign in to comment.