You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
3.2 KiB
170 lines
3.2 KiB
<HTML>
|
|
<HEAD>
|
|
<!-- Created by texi2html 1.56k from cln.texi on 2 June 2000 -->
|
|
|
|
<TITLE>CLN, a Class Library for Numbers - 1. Introduction</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
Go to the first, previous, <A HREF="cln_2.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.
|
|
<P><HR><P>
|
|
|
|
|
|
<H1><A NAME="SEC1" HREF="cln_toc.html#TOC1">1. Introduction</A></H1>
|
|
|
|
<P>
|
|
CLN is a library for computations with all kinds of numbers.
|
|
It has a rich set of number classes:
|
|
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
Integers (with unlimited precision),
|
|
|
|
<LI>
|
|
|
|
Rational numbers,
|
|
|
|
<LI>
|
|
|
|
Floating-point numbers:
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
Short float,
|
|
<LI>
|
|
|
|
Single float,
|
|
<LI>
|
|
|
|
Double float,
|
|
<LI>
|
|
|
|
Long float (with unlimited precision),
|
|
</UL>
|
|
|
|
<LI>
|
|
|
|
Complex numbers,
|
|
|
|
<LI>
|
|
|
|
Modular integers (integers modulo a fixed integer),
|
|
|
|
<LI>
|
|
|
|
Univariate polynomials.
|
|
</UL>
|
|
|
|
<P>
|
|
The subtypes of the complex numbers among these are exactly the
|
|
types of numbers known to the Common Lisp language. Therefore
|
|
<CODE>CLN</CODE> can be used for Common Lisp implementations, giving
|
|
<SAMP>`CLN'</SAMP> another meaning: it becomes an abbreviation of
|
|
"Common Lisp Numbers".
|
|
|
|
|
|
<P>
|
|
The CLN package implements
|
|
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
Elementary functions (<CODE>+</CODE>, <CODE>-</CODE>, <CODE>*</CODE>, <CODE>/</CODE>, <CODE>sqrt</CODE>,
|
|
comparisons, ...),
|
|
|
|
<LI>
|
|
|
|
Logical functions (logical <CODE>and</CODE>, <CODE>or</CODE>, <CODE>not</CODE>, ...),
|
|
|
|
<LI>
|
|
|
|
Transcendental functions (exponential, logarithmic, trigonometric, hyperbolic
|
|
functions and their inverse functions).
|
|
</UL>
|
|
|
|
<P>
|
|
CLN is a C++ library. Using C++ as an implementation language provides
|
|
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
efficiency: it compiles to machine code,
|
|
<LI>
|
|
|
|
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.
|
|
<LI>
|
|
|
|
algebraic syntax: You can use the <CODE>+</CODE>, <CODE>-</CODE>, <CODE>*</CODE>, <CODE>=</CODE>,
|
|
<CODE>==</CODE>, ... operators as in C or C++.
|
|
</UL>
|
|
|
|
<P>
|
|
CLN is memory efficient:
|
|
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
Small integers and short floats are immediate, not heap allocated.
|
|
<LI>
|
|
|
|
Heap-allocated memory is reclaimed through an automatic, non-interruptive
|
|
garbage collection.
|
|
</UL>
|
|
|
|
<P>
|
|
CLN is speed efficient:
|
|
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
The kernel of CLN has been written in assembly language for some CPUs
|
|
(<CODE>i386</CODE>, <CODE>m68k</CODE>, <CODE>sparc</CODE>, <CODE>mips</CODE>, <CODE>arm</CODE>).
|
|
<LI>
|
|
|
|
<A NAME="IDX1"></A>
|
|
On all CPUs, CLN may be configured to use the superefficient low-level
|
|
routines from GNU GMP version 3.
|
|
<LI>
|
|
|
|
It uses Karatsuba multiplication, which is significantly faster
|
|
for large numbers than the standard multiplication algorithm.
|
|
<LI>
|
|
|
|
For very large numbers (more than 12000 decimal digits), it uses
|
|
Schönhage-Strassen
|
|
<A NAME="IDX2"></A>
|
|
multiplication, which is an asymptotically optimal multiplication
|
|
algorithm, for multiplication, division and radix conversion.
|
|
</UL>
|
|
|
|
<P>
|
|
CLN aims at being easily integrated into larger software packages:
|
|
|
|
|
|
|
|
<UL>
|
|
<LI>
|
|
|
|
The garbage collection imposes no burden on the main application.
|
|
<LI>
|
|
|
|
The library provides hooks for memory allocation and exceptions.
|
|
</UL>
|
|
|
|
<P><HR><P>
|
|
Go to the first, previous, <A HREF="cln_2.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.
|
|
</BODY>
|
|
</HTML>
|