Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number #488

Draft
wants to merge 16 commits into
base: release-candidate
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.276.so` and executable `meevax`.
| `all` | Build shared-library `libmeevax.0.5.292.so` and executable `meevax`.
| `install` | Copy files into `/usr/local` directly.
| `package` | Generate debian package `meevax_0.5.276_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.276_amd64.deb`.
| `package` | Generate debian package `meevax_0.5.292_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.292_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.276
0.5.292
307 changes: 307 additions & 0 deletions basis/srfi-144.ss
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
(define-library (srfi 144)
(import (only (meevax binary64)
FP_FAST_FMA
binary64-abs
binary64-denormalized?
binary64-epsilon
binary64-expm1
binary64-exponent
binary64-fractional-part
binary64-fused-multiply-add
binary64-greatest
binary64-integer-log-binary
binary64-integral-part
binary64-least
binary64-log-binary
binary64-max
binary64-min
binary64-normalized-fraction
binary64-normalized?
binary64-sign-bit
binary64?
)
(only (meevax inexact)
copy-sign
e
euler
gamma
load-exponent
next-after
phi
pi
)
(only (scheme base)
*
+
-
/
<
<=
=
>
>=
and
ceiling
define
denominator
even?
expt
floor
if
inexact
integer?
negative?
numerator
odd?
or
positive?
round
truncate
values
zero?
)
(only (scheme inexact)
cos
exp
finite?
infinite?
log
nan?
sin
sqrt
)
)

(export fl-e fl-1/e fl-e-2 fl-e-pi/4 fl-log2-e fl-log10-e fl-log-2 fl-1/log-2
fl-log-3 fl-log-pi fl-log-10 fl-1/log-10 fl-pi fl-1/pi fl-2pi fl-pi/2
fl-pi/4 fl-pi-squared fl-degree fl-2/pi fl-2/sqrt-pi fl-sqrt-2
fl-sqrt-3 fl-sqrt-5 fl-sqrt-10 fl-1/sqrt-2 fl-cbrt-2 fl-cbrt-3
fl-4thrt-2 fl-phi fl-log-phi fl-1/log-phi fl-euler fl-e-euler
fl-sin-1 fl-cos-1 fl-gamma-1/2 fl-gamma-1/3 fl-gamma-2/3

fl-greatest fl-least fl-epsilon fl-fast-fl+* fl-integer-exponent-zero
fl-integer-exponent-nan

flonum fladjacent flcopysign make-flonum

flinteger-fraction flexponent flinteger-exponent
flnormalized-fraction-exponent flsign-bit

flonum? fl=? fl<? fl>? fl<=? fl>=? flunordered? flinteger? flzero?
flpositive? flnegative? flodd? fleven? flfinite? flinfinite? flnan?
flnormalized? fldenormalized?

flmax flmin fl+ fl* fl+* fl- fl/ flabs flabsdiff flposdiff flsgn
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
;
; flgamma flloggamma flfirst-bessel flsecond-bessel
; flerf flerfc
)

(begin (define fl-e e)

(define fl-1/e (/ 1 e))

(define fl-e-2 7.38905609893065) ; (define fl-e-2 (expt e 2)) yields 1 ULP error

(define fl-e-pi/4 (expt e (/ pi 4)))

(define fl-log2-e (log e 2))

(define fl-log10-e 0.4342944819032518) ; (define fl-log10-e (log e 10)) yields 1 ULP error

(define fl-log-2 (log 2))

(define fl-1/log-2 (/ 1 (log 2)))

(define fl-log-3 (log 3))

(define fl-log-pi (log pi))

(define fl-log-10 (log 10))

(define fl-1/log-10 0.4342944819032518) ; (define fl-1/log-10 (/ 1 (log 10))) yields 1 ULP error

(define fl-pi pi)

(define fl-1/pi (/ 1 pi))

(define fl-2pi (* 2 pi))

(define fl-pi/2 (/ pi 2))

(define fl-pi/4 (/ pi 4))

(define fl-pi-squared (expt pi 2))

(define fl-degree (/ pi 180))

(define fl-2/pi (/ 2 pi))

(define fl-2/sqrt-pi (/ 2 (sqrt pi)))

(define fl-sqrt-2 (sqrt 2))

(define fl-sqrt-3 (sqrt 3))

(define fl-sqrt-5 (sqrt 5))

(define fl-sqrt-10 (sqrt 10))

(define fl-1/sqrt-2 (/ 1 (sqrt 2)))

(define fl-cbrt-2 (expt 2 (/ 1 3)))

(define fl-cbrt-3 (expt 3 (/ 1 3)))

(define fl-4thrt-2 (expt 2 (/ 1 4)))

(define fl-phi phi)

(define fl-log-phi (log phi))

(define fl-1/log-phi 2.07808692123502753) ; (define fl-1/log-phi (/ 1 fl-log-phi)) yields 1 ULP error

(define fl-euler euler)

(define fl-e-euler (expt e euler))

(define fl-sin-1 (sin 1))

(define fl-cos-1 (cos 1))

(define fl-gamma-1/2 (gamma (/ 1 2)))

(define fl-gamma-1/3 2.67893853470774763) ; (define fl-gamma-1/3 (gamma (/ 1 3))) yields 1 ULP error

(define fl-gamma-2/3 (gamma (/ 2 3)))

(define fl-greatest binary64-greatest)

(define fl-least binary64-least)

(define fl-epsilon binary64-epsilon)

(define fl-fast-fl+* FP_FAST_FMA)

(define fl-integer-exponent-zero (binary64-integer-log-binary 0.0))

(define fl-integer-exponent-nan (binary64-integer-log-binary +nan.0))

(define flonum inexact)

(define fladjacent next-after)

(define flcopysign copy-sign)

(define make-flonum load-exponent)

(define (flinteger-fraction x)
(values (binary64-integral-part x)
(binary64-fractional-part x)))

(define flexponent binary64-log-binary)

(define flinteger-exponent binary64-integer-log-binary)

(define (flnormalized-fraction-exponent x)
(values (binary64-normalized-fraction x)
(binary64-exponent x)))

(define (flsign-bit x)
(if (binary64-sign-bit x) 1 0))

(define flonum? binary64?)

(define fl=? =)

(define fl<? <)

(define fl>? >)

(define fl<=? <=)

(define fl>=? >=)

(define (flunordered? x y)
(or (nan? x)
(nan? y)))

(define (flinteger? x)
(and (binary64? x)
(integer? x)))

(define flzero? zero?)

(define flpositive? positive?)

(define flnegative? negative?)

(define flodd? odd?)

(define fleven? even?)

(define flfinite? finite?)

(define flinfinite? infinite?)

(define flnan? nan?)

(define flnormalized? binary64-normalized?)

(define fldenormalized? binary64-denormalized?)

(define flmax binary64-max)

(define flmin binary64-min)

(define fl+ +)

(define fl* *)

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

(define fl- -)

(define fl/ /)

(define flabs binary64-abs)

(define (flabsdiff x y)
(flabs (- x y)))

(define (flposdiff x y)
(flmax (fl- x y) 0.0))

(define (flsgn x)
(flcopysign 1.0 x))

(define flnumerator numerator)

(define fldenominator denominator)

(define flfloor floor)

(define flceiling ceiling)

(define flround round)

(define fltruncate truncate)

(define flexp exp)

(define (flexp2 x)
(expt 2 x))

(define flexp-1 binary64-expm1)
)
)
1 change: 1 addition & 0 deletions configure/basis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace meevax
R"##(${srfi-78.ss})##",
R"##(${srfi-98.ss})##",
R"##(${srfi-111.ss})##",
R"##(${srfi-144.ss})##",
R"##(${srfi-149.ss})##",
};
}
Expand Down
2 changes: 2 additions & 0 deletions include/meevax/kernel/complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace meevax::inline kernel

auto real() const noexcept -> object const&;

explicit operator std::complex<int>() const;

explicit operator std::complex<double>() const;
};

Expand Down
Loading
Loading