Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oct
oct
Commits
1113e156
Commit
1113e156
authored
Dec 19, 2020
by
Raymond Toy
Browse files
Merge branch 'issue17updatereadme' into 'master'
Fix
#17
: Update README Closes
#17
See merge request
!15
parents
d0758610
c2bffa25
Pipeline
#2327
passed with stage
in 1 minute and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Sidebyside
README.md
View file @
1113e156
# Oct
A Lisp Implementation of QuadDouble Float
## Introduction
Oct is a portable Lisp implementation of quaddouble arithmetic. This
gives about 65 digits of precision. Quaddouble arithmetic uses four
doublefloat numbers to represent an extended precision number.
The implementation is modeled on the
[
quaddouble package
](
https://www.davidhbailey.com/dhbpapers/quaddouble.pdf
)
by Yozo
Hida. This package is in C++, but we have translated parts of it and
extended it to use Lisp. The intent is to provide all of the CL
arithmetic functions with a quaddouble implementation.
The implementation is modeled on the
[
quaddouble
package
](
http://www.cs.berkeley.edu/~yozo/papers/LBNL46996.ps.gz
)
by
[
Yozo Hida
](
http://www.cs.berkeley.edu/~yozo/
)
. This package is in
C++, but we have translated parts of it and extended it to use
Lisp. The intent is to provide all of the CL arithmetic functions with
a quaddouble implementation.
Further information will be provided at a later date. This is
currently a work in progress, but the current code has the basic
functionality implemented and includes all of the special functions
specified by CL. There are, undoubtedly, many bugs.
## Supported Lisps
This package has been tested with CMUCL, SBCL, Clisp, and Allegro. All
tests pass. Note that development is primarily done using CMUCL.
See the
[
wiki
](
https://gitlab.commonlisp.net/oct/oct//wikis/home
)
for more information.
## Building Oct
1.
Obtain a copy of Oct:

For a fresh checkout:

Users:
```
git clone recursesubmodules https://gitlab.commonlisp.net/oct/oct.git
```

Developrs:
```
git clone recursesubmodules git@commonlisp.net:oct/oct.git
```

To update a copy:
```
git pull recursesubmodules
```
1.
Make sure you have asdf. This is now commonly available with all
supported lisps, but if not, use
[
Quicklisp
](
https://www.quicklisp.org/beta/
)
to get it.
1.
To compile the package, assuming you've started lisp in the same
directory as oct:
```
(pushnew "./" asdf:*centralregistry*)
(asdf:oos 'asdf:loadop :oct)
```
1.
If desired, you can also run the test suite:
```
(asdf:testsystem :oct)
```
This should pass with some known test failures.
## Using Oct
Everything in Oct resides in the
`NET.COMMONLISP.OCT`
package, with a
nickname of
`OCT`
. The basic arithmetic operations of CL are shadowed
in this package so you can use natural Lisp expressions to operate on
quaddoubles. Special functions are included.
There are two types added:
*
`QDREAL`
A quaddouble type. This has about 65 digits of precision, or about 212 bits.
*
`QDCOMPLEX`
A complex type consisting of two `QDREAL` values.
The reader is also modified to make it easier to enter quaddouble
values.
`#q`
is used to enter both
`QDREAL`
and
`QDCOMPLEX`
types. For example
`#q1.25q5`
is the
`QDREAL`
with the value
125000.
The exponent marker is
`q`
. To enter a
`QDCOMPLEX`
value,
use
`#q(r i)`
where
`r`
and
`i`
are the real and imaginary parts. The
parts will be coerced to
`QDREAL`
type if necessary.
## Examples
Here are a few examples:
```
* (inpackage "OCT")
* (namedreadtables:inreadtable oct:octreadtable)
OCT> (/ (sqrt #q3) 2)
#q0.866025403784438646763723170752936183471402626905190314027903489696q0
OCT> (sin (/ +pi+ 3))
#q0.86602540378443864676372317075293618347140262690519031402790348972q0
OCT> (sqrt #q1)
#q(#q0.0q0 #q1.0q0)
OCT> (coerce 7 'qdcomplex)
#q(#q7.0q0 #q0.0q0)
OCT> (integerdecodefloat +pi+)
165424160919322423196824703508232170249081435635340508251270944637
215
1
OCT> +pi+
#q3.1415926535897932384626433832795028841971693993751058209749445923q0
OCT> (* 4 (atan #q1))
#q3.1415926535897932384626433832795028841971693993751058209749445923q0
```
Note that
`+pi+`
is the
`QDREAL`
value for pi.
## API
Oct has implementations for all of the numeric functions in
COMMONLISP updated to support quaddoubles. In addition, Oct
supports these:

`makeqd`

`jacobisn`

`jacobicn`

`jacobidn`

`elliptick`

`ellipticf`

`elliptice`

`ellipticec`

`carlsonrd`

`carlsonrf`

`carlsonrj`

`elliptictheta1`

`elliptictheta2`

`elliptictheta3`

`elliptictheta4`

`elliptictheta`

`erf`

`erfc`

`loggamma`

`gamma`

`psi`

`incompletegammalower`

`incompletegammaupper`

`fresnels`

`fresnelc`

`sinintegral`

`cosintegral`
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment