The wu-decimal Reference Manual

This is the wu-decimal Reference Manual, version 2.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 08:06:47 2024 GMT+0.

Table of Contents


1 Systems

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


1.1 wu-decimal

Arbitrary-precision decimal arithmetic

Author

Wukix Inc <>

License

FreeBSD

Long Description

Wu-Decimal enables convenient, arbitrary-precision decimal arithmetic through a reader macro, #$, and an update to the pprint dispatch table. Wu-Decimal uses the CL ratio type to store decimals, which enables numeric functions such as +, -, etc. to operate on decimal numbers in a natural way.

Version

2.0.0

Source

wu-decimal.asd.

Child Component

wu-decimal.lisp (file).


2 Files

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


2.1 Lisp


2.1.1 wu-decimal/wu-decimal.asd

Source

wu-decimal.asd.

Parent Component

wu-decimal (system).

ASDF Systems

wu-decimal.

Packages

wu-decimal-asd.


2.1.2 wu-decimal/wu-decimal.lisp

Source

wu-decimal.asd.

Parent Component

wu-decimal (system).

Packages

wu-decimal.

Public Interface
Internals

3 Packages

Packages are listed by definition order.


3.1 wu-decimal

Source

wu-decimal.lisp.

Use List

common-lisp.

Public Interface
Internals

3.2 wu-decimal-asd

Source

wu-decimal.asd.

Use List
  • asdf/interface.
  • common-lisp.

4 Definitions

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


4.1 Public Interface


4.1.1 Special variables

Special Variable: *print-decimal-mark*
Package

wu-decimal.

Source

wu-decimal.lisp.

Special Variable: *print-precision-loss*

Precision loss mode. Must be :error, :round, or :truncate

Package

wu-decimal.

Source

wu-decimal.lisp.


4.1.2 Ordinary functions

Function: $ (stream decimal colon atsign &optional d n w pad)

e.g. (format t "~/wu-decimal:$/" #$3.14)

Package

wu-decimal.

Source

wu-decimal.lisp.

Function: disable-decimal-printing-for-ratios ()
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: enable-decimal-printing-for-ratios ()
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: enable-reader-macro (&key exponent-allowed)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: f (stream number colon atsign &optional w d k ovf pad)

e.g. (format t "~/wu-decimal:F/" #$3.14)

Package

wu-decimal.

Source

wu-decimal.lisp.

Function: parse-decimal (string &key start end sign-allowed decimal-mark group-separator exponent-allowed junk-allowed)

PARSE-DECIMAL parses a decimal number from the substring of STRING delimited by START and END. Optional leading and trailing whitespace[1] is ignored. The character parameters DECIMAL-MARK and GROUP-SEPARATOR provide support for different (typically cultural) numerical conventions. For convenience, a GROUP-SEPARATOR of T will be treated as the comma character. The boolean SIGN-ALLOWED controls signage. EXPONENT-ALLOWED is a boolean or a sequence controlling exponent notation. Exponent notation follows the syntax for CL floats, with exception that the exponent marker must be ’e’ or ’E’ when EXPONENT-ALLOWED is T, or the exponent marker must be CHAR= to some element of EXPONENT-ALLOWED when EXPONENT-ALLOWED is a
sequence. JUNK-ALLOWED behaves as it does in PARSE-INTEGER. PARSE-DECIMAL returns two values: the parsed number of type DECIMAL, followed by the index of STRING where the parse terminated.
Example: (parse-decimal "1,205.42" :group-separator #\,) => 60271/50, 8

Package

wu-decimal.

Source

wu-decimal.lisp.


4.1.3 Types

Type: decimal ()
Package

wu-decimal.

Source

wu-decimal.lisp.


4.2 Internals


4.2.1 Ordinary functions

Function: count-digits (integer)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: decimal-reader (stream subchar arg)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: decimal-reader-exponent-allowed (stream subchar arg)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: decimal-to-digits (number &optional position relativep)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: decimal-to-string (x &optional width fdigits scale fmin)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: factor-out-powers-of-5 (numbr)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: find-multiplier (d)

Given an integer, d, of the form 2^m*5^n, compute c such that c*d = c*(2^m*5^n) = 10^max(m,n). Returns c and max(m,n). See http://wukix.com/lisp-decimals#theory for background.

Package

wu-decimal.

Source

wu-decimal.lisp.

Function: format-fixed-aux (stream number w d k ovf pad atsign)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: has-finite-decimal-digits (number)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: integer-to-digit-string (integer)

Converts an integer into a base 10 string. The sign is ignored.

Package

wu-decimal.

Source

wu-decimal.lisp.

Function: is-power-of-2 (number)
Package

wu-decimal.

Source

wu-decimal.lisp.

Function: whitespace-1-p (a-char)
Package

wu-decimal.

Source

wu-decimal.lisp.


4.2.2 Conditions

Condition: disallowed-loss-of-precision
Package

wu-decimal.

Source

wu-decimal.lisp.

Direct superclasses

condition.

Condition: incompatible-exponent-allowed-error
Package

wu-decimal.

Source

wu-decimal.lisp.

Direct superclasses

condition.

Condition: incompatible-mark-and-separator-error
Package

wu-decimal.

Source

wu-decimal.lisp.

Direct superclasses

condition.

Condition: out-of-bounds-error
Package

wu-decimal.

Source

wu-decimal.lisp.

Direct superclasses

condition.


4.2.3 Types

Type: decimal-for-pprint ()
Package

wu-decimal.

Source

wu-decimal.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   $  
C   D   E   F   H   I   P   W  
Index Entry  Section

$
$: Public ordinary functions

C
count-digits: Private ordinary functions

D
decimal-reader: Private ordinary functions
decimal-reader-exponent-allowed: Private ordinary functions
decimal-to-digits: Private ordinary functions
decimal-to-string: Private ordinary functions
disable-decimal-printing-for-ratios: Public ordinary functions

E
enable-decimal-printing-for-ratios: Public ordinary functions
enable-reader-macro: Public ordinary functions

F
f: Public ordinary functions
factor-out-powers-of-5: Private ordinary functions
find-multiplier: Private ordinary functions
format-fixed-aux: Private ordinary functions
Function, $: Public ordinary functions
Function, count-digits: Private ordinary functions
Function, decimal-reader: Private ordinary functions
Function, decimal-reader-exponent-allowed: Private ordinary functions
Function, decimal-to-digits: Private ordinary functions
Function, decimal-to-string: Private ordinary functions
Function, disable-decimal-printing-for-ratios: Public ordinary functions
Function, enable-decimal-printing-for-ratios: Public ordinary functions
Function, enable-reader-macro: Public ordinary functions
Function, f: Public ordinary functions
Function, factor-out-powers-of-5: Private ordinary functions
Function, find-multiplier: Private ordinary functions
Function, format-fixed-aux: Private ordinary functions
Function, has-finite-decimal-digits: Private ordinary functions
Function, integer-to-digit-string: Private ordinary functions
Function, is-power-of-2: Private ordinary functions
Function, parse-decimal: Public ordinary functions
Function, whitespace-1-p: Private ordinary functions

H
has-finite-decimal-digits: Private ordinary functions

I
integer-to-digit-string: Private ordinary functions
is-power-of-2: Private ordinary functions

P
parse-decimal: Public ordinary functions

W
whitespace-1-p: Private ordinary functions