... | ... | @@ -39,18 +39,20 @@ This package has been tested with CMUCL, SBCL, Clisp, and Allegro. All tests pas |
|
|
## Building Oct
|
|
|
1. Obtain a copy of Oct. Currently that means from the git repository http://common-lisp.net/r/projects/oct/oct.git, but also see the Oct gitweb for more links. The CVS repository is still available, but it is no longer used.
|
|
|
1. Get a copy of MK:DEFSYS from [clocc](http://clocc.sourceforge.net/), if you don't already have a copy. Or you can also use ASDF. Note that this might be out-of-date compared to the mk:defsys version.
|
|
|
1. (mk:oos "oct" :compile) will compile up everything. Or use (asdf:oos 'asdf:load-op :oct)
|
|
|
1. (mk:oos "oct-test" :compile) will compile up some simple tests. (qdi::all-tests) will run a series of tests. The accuracy of the results should be on the order of about 200 bits or more. There are a few cases where accuracy is much less than this, but that is due to the algorithm. If you have a copy of RT, you should run (rt:do-tests) to run the tests. All tests should pass.
|
|
|
1. `(mk:oos "oct" :compile)` will compile up everything. Or use `(asdf:oos 'asdf:load-op :oct)`
|
|
|
1. `(mk:oos "oct-test" :compile)` will compile up some simple tests. `(qdi::all-tests)` will run a series of tests. The accuracy of the results should be on the order of about 200 bits or more. There are a few cases where accuracy is much less than this, but that is due to the algorithm. If you have a copy of RT, you should run `(rt:do-tests)` to run the tests. All tests should pass.
|
|
|
## Using Oct
|
|
|
Everything in Oct resides in the NET.COMMON-LISP.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 quad-doubles. Special functions are included.
|
|
|
Everything in Oct resides in the `NET.COMMON-LISP.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 quad-doubles. Special functions are included.
|
|
|
|
|
|
There are two types added:
|
|
|
|
|
|
QD-REAL
|
|
|
A quad-double type. This has about 65 digits of precision, or about 212 bits.
|
|
|
QD-COMPLEX
|
|
|
A complex type consisting of two QD-REAL values.
|
|
|
The reader is also modified to make it easier to enter quad-double values. #q is used to enter both QD-REAL and QD-COMPLEX types. For example #q1.25q5 is the QD-REAL with the value 125000. The exponent marker is q. To enter a QD-COMPLEX value, use #q(r i) where r and i are the real and imaginary parts. The parts will be coerced to QD-REAL type if necessary.
|
|
|
* `QD-REAL`
|
|
|
|
|
|
A quad-double type. This has about 65 digits of precision, or about 212 bits.
|
|
|
* `QD-COMPLEX`
|
|
|
|
|
|
A complex type consisting of two `QD-REAL` values.
|
|
|
The reader is also modified to make it easier to enter quad-double values. `#q` is used to enter both `QD-REAL` and `QD-COMPLEX` types. For example `#q1.25q5` is the `QD-REAL` with the value 125000. The exponent marker is `q`. To enter a `QD-COMPLEX` value, use `#q(r i)` where `r` and `i` are the real and imaginary parts. The parts will be coerced to `QD-REAL` type if necessary.
|
|
|
|
|
|
## Examples
|
|
|
Here are a few examples:
|
... | ... | @@ -73,7 +75,7 @@ Here are a few examples: |
|
|
#q3.1415926535897932384626433832795028841971693993751058209749445923q0
|
|
|
```
|
|
|
|
|
|
Note that +pi+ is the QD-REAL value for pi.
|
|
|
Note that `+pi+` is the `QD-REAL` value for pi.
|
|
|
|
|
|
## Performance
|
|
|
Here are some simple benchmarks on the performance of this quad-double implementation. These benchmarks were run using CMUCL on a 1.42 GHz PPC. The columns are times relative to a double-float. The `%quad-double` represents the time using the internal implementaiton, without the overhead of CLOS. The QD-REAL column shows the effect of CLOS dispatch.
|
... | ... | |