[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1 Introduction
CLN is a library for computations with all kinds of numbers. It has a rich set of number classes:
- Integers (with unlimited precision),
- Rational numbers,
-
Floating-point numbers:
- - Short float,
- - Single float,
- - Double float,
- - Long float (with unlimited precision),
- Complex numbers,
- Modular integers (integers modulo a fixed integer),
- Univariate polynomials.
The subtypes of the complex numbers among these are exactly the
types of numbers known to the Common Lisp language. Therefore
CLN
can be used for Common Lisp implementations, giving
‘CLN’ another meaning: it becomes an abbreviation of
“Common Lisp Numbers”.
The CLN package implements
-
Elementary functions (
+
,-
,*
,/
,sqrt
, comparisons, …), -
Logical functions (logical
and
,or
,not
, …), - Transcendental functions (exponential, logarithmic, trigonometric, hyperbolic functions and their inverse functions).
CLN is a C++ library. Using C++ as an implementation language provides
- efficiency: it compiles to machine code,
- type safety: the C++ compiler knows about the number types and complains if, for example, you try to assign a float to an integer variable.
-
algebraic syntax: You can use the
+
,-
,*
,=
,==
, … operators as in C or C++.
CLN is memory efficient:
- Small integers and short floats are immediate, not heap allocated.
- Heap-allocated memory is reclaimed through an automatic, non-interruptive garbage collection.
CLN is speed efficient:
-
The kernel of CLN has been written in assembly language for some CPUs
(
i386
,m68k
,sparc
,mips
,arm
). - On all CPUs, CLN may be configured to use the superefficient low-level routines from GNU GMP version 3.
- It uses Karatsuba multiplication, which is significantly faster for large numbers than the standard multiplication algorithm.
- For very large numbers (more than 12000 decimal digits), it uses multiplication, which is an asymptotically optimal multiplication algorithm, for multiplication, division and radix conversion.
- It uses binary splitting for fast evaluation of series of rational numbers as they occur in the evaluation of elementary functions and some constants.
CLN aims at being easily integrated into larger software packages:
- The garbage collection imposes no burden on the main application.
- The library provides hooks for memory allocation and throws exceptions in case of errors.
-
All non-macro identifiers are hidden in namespace
cln
in order to avoid name clashes.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 27, 2013 using texi2html 5.0.