Version 2 (modified by rtoy, 4 years ago) (diff)

--

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.

QD-REAL::

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.

Here are a few examples of using OCT:

```  CL-USER (in-package "QD")
QD> (/ (sqrt #q3) 2)
#q0.866025403784438646763723170752936183471402626905190314027903489696q0
QD> (sin (/ +pi+ 3))
#q0.86602540378443864676372317075293618347140262690519031402790348972q0
QD> (sqrt #q-1)
#q(#q0.0q0 #q1.0q0)
QD> (coerce 7 'qd-complex)
#q(#q7.0q0 #q0.0q0)
QD> (integer-decode-float +pi+)
165424160919322423196824703508232170249081435635340508251270944637
-215
1
QD> +pi+
#q3.1415926535897932384626433832795028841971693993751058209749445923q0
QD> (* 4 (atan #q1))
#q3.1415926535897932384626433832795028841971693993751058209749445923q0
```

Note that +pi+ is the QD-REAL value for pi.