The computable-reals Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The computable-reals Reference Manual

This is the computable-reals Reference Manual, version 1.0.1, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:38:21 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Computable Reals

Introduction

Computable real numbers x are interpreted as (potentially) infinite fractions in base 2 that are specified through a rule for computation of an integer a with |(2^k)*x - a| <= 1 for any k>=0.

The internal data structure should not be accessed.

The interface for the outside world is as follows:

The type CREAL is a supertype of the type RATIONAL. (CREAL-P x), for an object x, returns T if x is of type CREAL, otherwise NIL.

(APPROX-R x k), for a CREAL x and an integer k>=0, returns an integer a with |(2^k)*x - a| < 1.

(MAKE-REAL fun) returns the real number given by fun. Here fun is a function taking an argument k, that computes a as above.

CREALs are output by print etc. as a decimal fraction. The error hereby is at most one unit in the last digit that was output. The number of decimal digits after the decimal point is defined through the dynamic variable *PRINT-PREC*.

For comparison operations etc. a precision threshold is used. It is defined through the dynamic variable *CREAL-TOLERANCE*. Its value should be a nonnegative integer n, meaning that numbers are considered equal if they differ by at most 2^(-n).

Exported Functions and Constants

The following functions, constants and variables are exported. (The package is named "REALS".)

CREAL                  type        type of the computable real numbers
CREAL-P object         function    tests for type CREAL
*PRINT-PREC*           variable    specifies precision of output
*CREAL-TOLERANCE*      variable    precision threshold for comparison
APPROX-R x:creal k:int>=0
                       function    returns approximation of x to k digits
MAKE-REAL function     function    creates object of type CREAL
RAW-APPROX-R x:creal   function    returns 3 values a,n,s with:
                                   if a = 0: |x| <= 2^(-n), s = 0
                                       and n >= *CREAL-TOLERANCE*
                                   else: a0 integer > 4, n0 integer >=0,
                                       s = +1 or -1, and sign(x) = s,
                                       (a-1)*2^(-n) <= |x| <= (a+1)*2^(-n)
PRINT-R x:creal k:int>=0 &optional (flag t)
                       function    outputs x with k decimal digits.
                                   If flag is true, first a newline.
+R {creal}*            function    computes the sum of the arguments
-R creal {creal}*      function    computes negative or difference
*R {creal}*            function    computes the product of the arguments
/R creal {creal}*      function    computes reciprocal or quotient
SQRT-R creal           function    computes the square root
+LOG2-R+               constant    log(2)
+PI-R+                 constant    pi
+2PI-R+                constant    2*pi
+PI/2-R+               constant    pi/2
+PI/4-R+               constant    pi/4
LOG-R x:creal &optional b:creal
                       function    computes the logarithm of n in base b;
                                   default is the natural logarithm
EXP-R creal            function    computes the exponential function
EXPT-R x:creal y:creal function    computes x^y
SIN-R creal            function    computes the sine
COS-R creal            function    computes the cosine
TAN-R creal            function    computes the tangent
ATAN-R x:creal &optional y:creal
                       function    computes the arctangent of x or
                                   the phase angle of (x,y)
ASH-R x:creal n:int    function    computes x * 2^n
ROUND-R x:creal &optional y:creal
                       function    computes two values q (integer) and r
                                   (creal) with x = q*y + r and |r|<=|y|/2
                                   according to the precision specified by
                                   *CREAL-TOLERANCE*
FLOOR-R x:creal &optional y:creal
                       function    like ROUND-R, corresponding to floor
CEILING-R x:creal &optional y:creal
                       function    like ROUND-R, corresponding to ceiling
TRUNCATE-R x:creal &optional y:creal
                       function    like ROUND-R, corresponding to truncate

Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 computable-reals

Maintainer

Robert Smith <robert@stylewarning.com>

Author

Michael Stoll

Description

Computable real numbers.

Long Description

Arbitrary-precision, re-computing real-numbers.

Version

1.0.1

Source

computable-reals.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 computable-reals.asd

Location

computable-reals.asd

Systems

computable-reals (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 computable-reals/package.lisp

Parent

computable-reals (system)

Location

package.lisp

Packages

computable-reals


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 computable-reals/constants.lisp

Dependency

package.lisp (file)

Parent

computable-reals (system)

Location

constants.lisp

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.4 computable-reals/reals.lisp

Dependency

constants.lisp (file)

Parent

computable-reals (system)

Location

reals.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.5 computable-reals/get-approximations.lisp

Dependency

reals.lisp (file)

Parent

computable-reals (system)

Location

get-approximations.lisp


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 computable-reals

Source

package.lisp (file)

Nickname

cr

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *creal-tolerance*

precision threshold for the comparison of CREALs, denoting the number of binary digits after the decimal point

Package

computable-reals

Source

reals.lisp (file)

Special Variable: *print-prec*

number of decimal digits after the decimal point during output of CREALs

Package

computable-reals

Source

reals.lisp (file)

Special Variable: +2pi-r+

2*pi as CREAL

Package

computable-reals

Source

constants.lisp (file)

Special Variable: +log2-r+

log(2) as CREAL

Package

computable-reals

Source

constants.lisp (file)

Special Variable: +pi-r+

pi as CREAL

Package

computable-reals

Source

constants.lisp (file)

Special Variable: +pi/2-r+

pi/2 as CREAL

Package

computable-reals

Source

constants.lisp (file)

Special Variable: +pi/4-r+

pi/4 as CREAL

Package

computable-reals

Source

constants.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: *r &rest ARGS &aux PN RL

Multiplication for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: +r &rest ARGS &aux SN RL

addition of CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: -r X1 &rest ARGS

subtraction and negation of CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: /r X1 &rest ARGS

division for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: approx-r X K

Computes approximations for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: ash-r X N

shift function for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: atan-r X &optional Y

arctangent for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: ceiling-r X &optional Y L

ceiling for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: cos-r X

cosine for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: creal-p X

Is X a CREAL?

Package

computable-reals

Source

reals.lisp (file)

Function: exp-r X

exponential function for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: expt-r X Y &aux S

exponentiation function for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: floor-r X &optional Y L

floor for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: log-r X &optional B

logarithm for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: make-real COMP

Create a C-REAL from a computation function COMP.

Package

computable-reals

Source

reals.lisp (file)

Function: print-r X K &optional FLAG STREAM

output function for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: raw-approx-r X

Returns an approximation for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: round-r X &optional Y L

round for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: sin-r X

sine for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: sqrt-r X

square root for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: tan-r X

tangent for CREALs

Package

computable-reals

Source

reals.lisp (file)

Function: truncate-r X &optional Y L

truncate for CREALs

Package

computable-reals

Source

reals.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Types

Type: creal ()

The type of the computable real numbers.

Package

computable-reals

Source

reals.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: atan-r0 X
Package

computable-reals

Source

reals.lisp (file)

Function: atan-r1 X
Package

computable-reals

Source

reals.lisp (file)

Function: c-real-compute INSTANCE
Package

computable-reals

Source

reals.lisp (file)

Function: c-real-p OBJECT
Package

computable-reals

Source

reals.lisp (file)

Function: c-real-precision INSTANCE
Function: (setf c-real-precision) VALUE INSTANCE
Package

computable-reals

Source

reals.lisp (file)

Function: c-real-value INSTANCE
Function: (setf c-real-value) VALUE INSTANCE
Package

computable-reals

Source

reals.lisp (file)

Function: cos-r1 X
Package

computable-reals

Source

reals.lisp (file)

Function: creal-print X K FLAG STREAM
Package

computable-reals

Source

reals.lisp (file)

Function: divide-r NAME WHAT X Y L
Package

computable-reals

Source

reals.lisp (file)

Function: exp-r1 X
Package

computable-reals

Source

reals.lisp (file)

Function: expt-r1 X Y
Package

computable-reals

Source

reals.lisp (file)

Function: get-approx X K
Package

computable-reals

Source

reals.lisp (file)

Function: invert-r X
Package

computable-reals

Source

reals.lisp (file)

Function: log-r1 X
Package

computable-reals

Source

reals.lisp (file)

Function: log-r2 X
Package

computable-reals

Source

reals.lisp (file)

Function: make-c-real &key (VALUE VALUE) (PRECISION PRECISION) (COMPUTE COMPUTE)
Package

computable-reals

Source

reals.lisp (file)

Function: minus-r X
Package

computable-reals

Source

reals.lisp (file)

Function: print-c-real X STREAM D
Package

computable-reals

Source

reals.lisp (file)

Function: rational-sqrt X
Package

computable-reals

Source

reals.lisp (file)

Function: raw-approx-cr X
Package

computable-reals

Source

reals.lisp (file)

Function: rest-help-r X Y Q
Package

computable-reals

Source

reals.lisp (file)

Function: round-cr A K
Package

computable-reals

Source

reals.lisp (file)

Function: sin-r1 X
Package

computable-reals

Source

reals.lisp (file)

Function: tenpower K
Package

computable-reals

Source

reals.lisp (file)

Function: transf X
Package

computable-reals

Source

reals.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Structures

Structure: c-real ()
Package

computable-reals

Source

reals.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

print-object (method)

Direct slots
Slot: value
Type

integer

Initform

0

Readers

c-real-value (function)

Writers

(setf c-real-value) (function)

Slot: precision
Type

(integer -1 *)

Initform

-1

Readers

c-real-precision (function)

Writers

(setf c-real-precision) (function)

Slot: compute
Type

(function ((integer 0 *)) integer)

Readers

c-real-compute (function)

Writers

(setf c-real-compute) (function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
computable-reals.asd: The computable-reals<dot>asd file
computable-reals/constants.lisp: The computable-reals/constants<dot>lisp file
computable-reals/get-approximations.lisp: The computable-reals/get-approximations<dot>lisp file
computable-reals/package.lisp: The computable-reals/package<dot>lisp file
computable-reals/reals.lisp: The computable-reals/reals<dot>lisp file

F
File, Lisp, computable-reals.asd: The computable-reals<dot>asd file
File, Lisp, computable-reals/constants.lisp: The computable-reals/constants<dot>lisp file
File, Lisp, computable-reals/get-approximations.lisp: The computable-reals/get-approximations<dot>lisp file
File, Lisp, computable-reals/package.lisp: The computable-reals/package<dot>lisp file
File, Lisp, computable-reals/reals.lisp: The computable-reals/reals<dot>lisp file

L
Lisp File, computable-reals.asd: The computable-reals<dot>asd file
Lisp File, computable-reals/constants.lisp: The computable-reals/constants<dot>lisp file
Lisp File, computable-reals/get-approximations.lisp: The computable-reals/get-approximations<dot>lisp file
Lisp File, computable-reals/package.lisp: The computable-reals/package<dot>lisp file
Lisp File, computable-reals/reals.lisp: The computable-reals/reals<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (   *   +   -   /  
A   C   D   E   F   G   I   L   M   P   R   S   T  
Index Entry  Section

(
(setf c-real-precision): Internal functions
(setf c-real-value): Internal functions

*
*r: Exported functions

+
+r: Exported functions

-
-r: Exported functions

/
/r: Exported functions

A
approx-r: Exported functions
ash-r: Exported functions
atan-r: Exported functions
atan-r0: Internal functions
atan-r1: Internal functions

C
c-real-compute: Internal functions
c-real-p: Internal functions
c-real-precision: Internal functions
c-real-value: Internal functions
ceiling-r: Exported functions
cos-r: Exported functions
cos-r1: Internal functions
creal-p: Exported functions
creal-print: Internal functions

D
divide-r: Internal functions

E
exp-r: Exported functions
exp-r1: Internal functions
expt-r: Exported functions
expt-r1: Internal functions

F
floor-r: Exported functions
Function, (setf c-real-precision): Internal functions
Function, (setf c-real-value): Internal functions
Function, *r: Exported functions
Function, +r: Exported functions
Function, -r: Exported functions
Function, /r: Exported functions
Function, approx-r: Exported functions
Function, ash-r: Exported functions
Function, atan-r: Exported functions
Function, atan-r0: Internal functions
Function, atan-r1: Internal functions
Function, c-real-compute: Internal functions
Function, c-real-p: Internal functions
Function, c-real-precision: Internal functions
Function, c-real-value: Internal functions
Function, ceiling-r: Exported functions
Function, cos-r: Exported functions
Function, cos-r1: Internal functions
Function, creal-p: Exported functions
Function, creal-print: Internal functions
Function, divide-r: Internal functions
Function, exp-r: Exported functions
Function, exp-r1: Internal functions
Function, expt-r: Exported functions
Function, expt-r1: Internal functions
Function, floor-r: Exported functions
Function, get-approx: Internal functions
Function, invert-r: Internal functions
Function, log-r: Exported functions
Function, log-r1: Internal functions
Function, log-r2: Internal functions
Function, make-c-real: Internal functions
Function, make-real: Exported functions
Function, minus-r: Internal functions
Function, print-c-real: Internal functions
Function, print-r: Exported functions
Function, rational-sqrt: Internal functions
Function, raw-approx-cr: Internal functions
Function, raw-approx-r: Exported functions
Function, rest-help-r: Internal functions
Function, round-cr: Internal functions
Function, round-r: Exported functions
Function, sin-r: Exported functions
Function, sin-r1: Internal functions
Function, sqrt-r: Exported functions
Function, tan-r: Exported functions
Function, tenpower: Internal functions
Function, transf: Internal functions
Function, truncate-r: Exported functions

G
get-approx: Internal functions

I
invert-r: Internal functions

L
log-r: Exported functions
log-r1: Internal functions
log-r2: Internal functions

M
make-c-real: Internal functions
make-real: Exported functions
minus-r: Internal functions

P
print-c-real: Internal functions
print-r: Exported functions

R
rational-sqrt: Internal functions
raw-approx-cr: Internal functions
raw-approx-r: Exported functions
rest-help-r: Internal functions
round-cr: Internal functions
round-r: Exported functions

S
sin-r: Exported functions
sin-r1: Internal functions
sqrt-r: Exported functions

T
tan-r: Exported functions
tenpower: Internal functions
transf: Internal functions
truncate-r: Exported functions

Jump to:   (   *   +   -   /  
A   C   D   E   F   G   I   L   M   P   R   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
C   P   S   V  
Index Entry  Section

*
*creal-tolerance*: Exported special variables
*print-prec*: Exported special variables

+
+2pi-r+: Exported special variables
+log2-r+: Exported special variables
+pi-r+: Exported special variables
+pi/2-r+: Exported special variables
+pi/4-r+: Exported special variables

C
compute: Internal structures

P
precision: Internal structures

S
Slot, compute: Internal structures
Slot, precision: Internal structures
Slot, value: Internal structures
Special Variable, *creal-tolerance*: Exported special variables
Special Variable, *print-prec*: Exported special variables
Special Variable, +2pi-r+: Exported special variables
Special Variable, +log2-r+: Exported special variables
Special Variable, +pi-r+: Exported special variables
Special Variable, +pi/2-r+: Exported special variables
Special Variable, +pi/4-r+: Exported special variables

V
value: Internal structures

Jump to:   *   +  
C   P   S   V  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S   T  
Index Entry  Section

C
c-real: Internal structures
computable-reals: The computable-reals system
computable-reals: The computable-reals package
creal: Exported types

P
Package, computable-reals: The computable-reals package

S
Structure, c-real: Internal structures
System, computable-reals: The computable-reals system

T
Type, creal: Exported types

Jump to:   C   P   S   T