]> www.ginac.de Git - cln.git/blobdiff - doc/cln.tex
Prepare for autoconf-2.60.
[cln.git] / doc / cln.tex
index d718288bdf6923a9fede567be8e29475e04cff49..5e47dd0379199df4045362c07b7f422941fa1bf6 100644 (file)
@@ -12,6 +12,9 @@
 @end iftex
 @c %**end of header
 
+@direntry
+* CLN: (cln).                       Class Library for Numbers (C++).
+@end direntry
 
 @c My own index.
 @defindex my
 This file documents @sc{cln}, a Class Library for Numbers.
 
 Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
-Richard Kreckel, @code{<kreckel@@ginac.de>}.
+Richard B. Kreckel, @code{<kreckel@@ginac.de>}.
 
-Copyright (C)  Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000.
+Copyright (C)  Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005.
+Copyright (C)  Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -65,7 +69,9 @@ by the author.
 @author by Bruno Haible
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000.
+Copyright @copyright{} Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005.
+@sp 0
+Copyright @copyright{} Richard Kreckel 2000, 2001, 2002, 2003, 2004, 2005.
 
 @sp 2
 Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
@@ -89,6 +95,10 @@ by the author.
 @page
 
 
+@c Table of contents
+@contents
+
+
 @node Top, Introduction, (dir), (dir)
 
 @c @menu
@@ -204,8 +214,8 @@ Sch{@"o}nhage-Strassen
 @cindex Sch{@"o}nhage-Strassen multiplication
 @end iftex
 @ifinfo
-Schönhage-Strassen
-@cindex Schönhage-Strassen multiplication
+Schnhage-Strassen
+@cindex Schnhage-Strassen multiplication
 @end ifinfo
 multiplication, which is an asymptotically optimal multiplication
 algorithm, for multiplication, division and radix conversion.
@@ -236,9 +246,7 @@ This section describes how to install the CLN package on your system.
 @subsection C++ compiler
 
 To build CLN, you need a C++ compiler.
-Actually, you need GNU @code{g++ 2.90} or newer, the EGCS compilers will
-do.
-I recommend GNU @code{g++ 2.95} or newer.
+Actually, you need GNU @code{g++ 2.95} or newer.
 
 The following C++ features are used:
 classes, member functions, overloading of functions and operators,
@@ -248,48 +256,18 @@ templates and namespaces.
 The following C++ features are not used:
 @code{new}, @code{delete}, virtual inheritance, exceptions.
 
-CLN relies on semi-automatic ordering of initializations
-of static and global variables, a feature which I could
-implement for GNU g++ only.
-
-@ignore
-@comment cl_modules.h requires g++
-Therefore nearly any C++ compiler will do.
-
-The following C++ compilers are known to compile CLN:
-@itemize @minus
-@item
-GNU @code{g++ 2.7.0}, @code{g++ 2.7.2}
-@item
-SGI @code{CC 4}
-@end itemize
-
-The following C++ compilers are known to be unusable for CLN:
-@itemize @minus
-@item
-On SunOS 4, @code{CC 2.1}, because it doesn't grok @code{//} comments
-in lines containing @code{#if} or @code{#elif} preprocessor commands.
-@item
-On AIX 3.2.5, @code{xlC}, because it doesn't grok the template syntax
-in @code{cl_SV.h} and @code{cl_GV.h}, because it forces most class types
-to have default constructors, and because it probably miscompiles the
-integer multiplication routines.
-@item
-On AIX 4.1.4.0, @code{xlC}, because when optimizing, it sometimes converts
-@code{short}s to @code{int}s by zero-extend.
-@item
-GNU @code{g++ 2.5.8}
-@item
-On HPPA, GNU @code{g++ 2.7.x}, because the semi-automatic ordering of
-initializations will not work.
-@end itemize
-@end ignore
+CLN relies on semi-automatic ordering of initializations of static and
+global variables, a feature which I could implement for GNU g++
+only. Also, it is not known whether this semi-automatic ordering works
+on all platforms when a non-GNU assembler is being used.
 
 @subsection Make utility
 @cindex @code{make}
 
 To build CLN, you also need to have GNU @code{make} installed.
 
+Only GNU @code{make} 3.77 is unusable for CLN; other versions work fine.
+
 @subsection Sed utility
 @cindex @code{sed}
 
@@ -314,7 +292,7 @@ If on your system, @samp{make} is not GNU @code{make}, you have to use
 
 The @code{configure} command checks out some features of your system and
 C++ compiler and builds the @code{Makefile}s. The @code{make} command
-builds the library. This step may take 4 hours on an average workstation.
+builds the library. This step may take about an hour on an average workstation.
 The @code{make check} runs some test to check that no important subroutine
 has been miscompiled.
 
@@ -351,33 +329,10 @@ $ CC="gcc -V egcs-2.91.60" CFLAGS="-O -g" \
   CXX="g++ -V egcs-2.91.60" CXXFLAGS="-O -g" ./configure
 $ CC="gcc -V 2.95.2" CFLAGS="-O2 -fno-exceptions" \
   CXX="g++ -V 2.95.2" CFLAGS="-O2 -fno-exceptions" ./configure
+$ CC="gcc -V 3.0.4" CFLAGS="-O2 -finline-limit=1000 -fno-exceptions" \
+  CXX="g++ -V 3.0.4" CFLAGS="-O2 -finline-limit=1000 -fno-exceptions" \
+  ./configure
 @end example
-@ignore
-@comment cl_modules.h requires g++
-You should not mix GNU and non-GNU compilers. So, if @code{CXX} is a non-GNU
-compiler, @code{CC} should be set to a non-GNU compiler as well. Examples:
-
-@example
-$ CC="cc" CFLAGS="-O" CXX="CC" CXXFLAGS="-O" ./configure
-$ CC="gcc -V 2.7.0" CFLAGS="-g" CXX="g++ -V 2.7.0" CXXFLAGS="-g" ./configure
-@end example
-
-On SGI Irix 5, if you wish not to use @code{g++}:
-
-@example
-$ CC="cc" CFLAGS="-O" CXX="CC" CXXFLAGS="-O -Olimit 16000" ./configure
-@end example
-
-On SGI Irix 6, if you wish not to use @code{g++}:
-
-@example
-$ CC="cc -32" CFLAGS="-O" CXX="CC -32" CXXFLAGS="-O -Olimit 34000" \
-  ./configure --without-gmp
-$ CC="cc -n32" CFLAGS="-O" CXX="CC -n32" CXXFLAGS="-O \
-  -OPT:const_copy_limit=32400 -OPT:global_limit=32400 -OPT:fprop_limit=4000" \
-  ./configure --without-gmp
-@end example
-@end ignore
 
 Note that for these environment variables to take effect, you have to set
 them (assuming a Bourne-compatible shell) on the same line as the
@@ -390,16 +345,32 @@ Currently CLN works only with the GNU @code{g++} compiler, and only in
 optimizing mode. So you should specify at least @code{-O} in the CXXFLAGS,
 or no CXXFLAGS at all. (If CXXFLAGS is not set, CLN will use @code{-O}.)
 
-If you use @code{g++} version 2.8.x or egcs-2.91.x (a.k.a. egcs-1.1) or
-gcc-2.95.x, I recommend adding @samp{-fno-exceptions} to the CXXFLAGS.
-This will likely generate better code.
+If you use @code{g++} 3.x, I recommend adding @samp{-finline-limit=1000}
+to the CXXFLAGS. This is essential for good code.
+
+If you use @code{g++} gcc-2.95.x or gcc-3.x , I recommend adding
+@samp{-fno-exceptions} to the CXXFLAGS. This will likely generate better code.
+
+If you use @code{g++} from gcc-3.0.4 or older on Sparc, add either
+@samp{-O}, @samp{-O1} or @samp{-O2 -fno-schedule-insns} to the
+CXXFLAGS. With full @samp{-O2}, @code{g++} miscompiles the division
+routines. If you use @code{g++} older than 2.95.3 on Sparc you should
+also specify @samp{--disable-shared} because of bad code produced in the
+shared library. Also, do not use gcc-3.0 on Sparc for compiling CLN, it
+won't work at all.
 
-If you use @code{g++} version egcs-2.91.x (egcs-1.1) or gcc-2.95.x on Sparc,
-add either @samp{-O}, @samp{-O1} or @samp{-O2 -fno-schedule-insns} to the 
-CXXFLAGS.  With full @samp{-O2}, @code{g++} miscompiles the division routines.
-Also, if you have @code{g++} version egcs-1.1.1 or older on Sparc, you must
-specify @samp{--disable-shared} because @code{g++} would miscompile parts of 
-the library.
+If you use @code{g++} on OSF/1 or Tru64 using gcc-2.95.x, you should
+specify @samp{--disable-shared} because of linker problems with
+duplicate symbols in shared libraries.  If you use @code{g++} from
+gcc-3.0.n, with n larger than 1, you should @emph{not} add
+@samp{-fno-exceptions} to the CXXFLAGS, since that will generate wrong
+code (gcc-3.1 is okay again, as is gcc-3.0).
+
+Also, please do not compile CLN with @code{g++} using the @code{-O3}
+optimization level.  This leads to inferior code quality.
+
+If you use @code{g++} from gcc-3.1, it will need 235 MB of virtual memory.
+You might need some swap space if your machine doesn't have 512 MB of RAM.
 
 By default, both a shared and a static library are built.  You can build
 CLN as a static (or shared) library only, by calling @code{configure} with
@@ -409,6 +380,10 @@ on all architectures.  Try disabling them if you run into linker
 problems.  Also, they are generally somewhat slower than static
 libraries so runtime-critical applications should be linked statically.
 
+If you use @code{g++} from gcc-3.1 with option @samp{-g}, you will need
+some disk space: 335 MB for building as both a shared and a static library,
+or 130 MB when building as a shared library only.
+
 
 @subsection Using the GNU MP Library
 @cindex GMP
@@ -553,7 +528,8 @@ Rational numbers are always normalized to the form
 are coprime integers and the denominator is positive. If the resulting
 denominator is @code{1}, the rational number is converted to an integer.
 
-Small integers (typically in the range @code{-2^30}@dots{}@code{2^30-1},
+@cindex immediate numbers
+Small integers (typically in the range @code{-2^29}@dots{}@code{2^29-1},
 for 32-bit machines) are especially efficient, because they consume no heap
 allocation. Otherwise the distinction between these immediate integers
 (called ``fixnums'') and heap allocated integers (called ``bignums'')
@@ -741,21 +717,26 @@ Conversions from any class to any of its subclasses (``derived classes'' in
 C++ terminology) are not provided. Instead, you can assert and check
 that a value belongs to a certain subclass, and return it as element of that
 class, using the @samp{As} and @samp{The} macros.
+@cindex cast
 @cindex @code{As()()}
 @code{As(@var{type})(@var{value})} checks that @var{value} belongs to
 @var{type} and returns it as such.
 @cindex @code{The()()}
 @code{The(@var{type})(@var{value})} assumes that @var{value} belongs to
 @var{type} and returns it as such. It is your responsibility to ensure
-that this assumption is valid.
+that this assumption is valid.  Since macros and namespaces don't go
+together well, there is an equivalent to @samp{The}: the template
+@samp{the}.
+
 Example:
 
 @example
 @group
    cl_I x = @dots{};
    if (!(x >= 0)) abort();
-   cl_I ten_x = The(cl_I)(expt(10,x)); // If x >= 0, 10^x is an integer.
+   cl_I ten_x_a = The(cl_I)(expt(10,x)); // If x >= 0, 10^x is an integer.
                 // In general, it would be a rational number.
+   cl_I ten_x_b = the<cl_I>(expt(10,x)); // The same as above.
 @end group
 @end example
 
@@ -806,7 +787,7 @@ through the @code{cl_float} conversion function, see
 @code{e} to 40 decimal places, first construct 1.0 to 40 decimal places
 and then apply the exponential function:
 @example
-   cl_float_format_t precision = cl_float_format(40);
+   float_format_t precision = float_format(40);
    cl_F e = exp(cl_float(1,precision));
 @end example
 
@@ -1391,7 +1372,7 @@ Exponentiation: Returns @code{x^y = exp(y*log(x))}.
 The constant e = exp(1) = 2.71828@dots{} is returned by the following functions:
 
 @table @code
-@item cl_F exp1 (cl_float_format_t f)
+@item cl_F exp1 (float_format_t f)
 @cindex @code{exp1 ()}
 Returns e as a float of format @code{f}.
 
@@ -1507,7 +1488,7 @@ Proof: arctan(z) = artanh(iz)/i, we know the range of the artanh function.
 Archimedes' constant pi = 3.14@dots{} is returned by the following functions:
 
 @table @code
-@item cl_F pi (cl_float_format_t f)
+@item cl_F pi (float_format_t f)
 @cindex @code{pi ()}
 Returns pi as a float of format @code{f}.
 
@@ -1666,7 +1647,7 @@ Proof: Write z = x+iy. Examine
 Euler's constant C = 0.577@dots{} is returned by the following functions:
 
 @table @code
-@item cl_F eulerconst (cl_float_format_t f)
+@item cl_F eulerconst (float_format_t f)
 @cindex @code{eulerconst ()}
 Returns Euler's constant as a float of format @code{f}.
 
@@ -1681,7 +1662,7 @@ Catalan's constant G = 0.915@dots{} is returned by the following functions:
 @cindex Catalan's constant
 
 @table @code
-@item cl_F catalanconst (cl_float_format_t f)
+@item cl_F catalanconst (float_format_t f)
 @cindex @code{catalanconst ()}
 Returns Catalan's constant as a float of format @code{f}.
 
@@ -1700,7 +1681,7 @@ Riemann's zeta function at an integral point @code{s>1} is returned by the
 following functions:
 
 @table @code
-@item cl_F zeta (int s, cl_float_format_t f)
+@item cl_F zeta (int s, float_format_t f)
 @cindex @code{zeta ()}
 Returns Riemann's zeta function at @code{s} as a float of format @code{f}.
 
@@ -1823,7 +1804,7 @@ Returns true if some bit is set in both @code{x} and @code{y}, i.e. if
 Returns true if the @code{n}th bit (from the right) of @code{x} is set.
 Bit 0 is the least significant bit.
 
-@item uintL logcount (const cl_I& x)
+@item uintC logcount (const cl_I& x)
 @cindex @code{logcount ()}
 Returns the number of one bits in @code{x}, if @code{x} >= 0, or
 the number of zero bits in @code{x}, if @code{x} < 0.
@@ -1832,7 +1813,7 @@ the number of zero bits in @code{x}, if @code{x} < 0.
 The following functions operate on intervals of bits in integers. 
 The type
 @example
-struct cl_byte @{ uintL size; uintL position; @};
+struct cl_byte @{ uintC size; uintC position; @};
 @end example
 @cindex @code{cl_byte}
 represents the bit interval containing the bits
@@ -1914,20 +1895,20 @@ Shifts @code{x} by @code{y} bits to the left (if @code{y}>=0) or
 by @code{-y} bits to the right (if @code{y}<=0). In other words, this
 returns @code{floor(x * expt(2,y))}.
 
-@item uintL integer_length (const cl_I& x)
+@item uintC integer_length (const cl_I& x)
 @cindex @code{integer_length ()}
 Returns the number of bits (excluding the sign bit) needed to represent @code{x}
 in two's complement notation. This is the smallest n >= 0 such that
 -2^n <= x < 2^n. If x > 0, this is the unique n > 0 such that
 2^(n-1) <= x < 2^n.
 
-@item uintL ord2 (const cl_I& x)
+@item uintC ord2 (const cl_I& x)
 @cindex @code{ord2 ()}
 @code{x} must be non-zero. This function returns the number of 0 bits at the
 right of @code{x} in two's complement notation. This is the largest n >= 0
 such that 2^n divides @code{x}.
 
-@item uintL power2p (const cl_I& x)
+@item uintC power2p (const cl_I& x)
 @cindex @code{power2p ()}
 @code{x} must be > 0. This function checks whether @code{x} is a power of 2.
 If @code{x} = 2^(n-1), it returns n. Else it returns 0.
@@ -1938,7 +1919,7 @@ If @code{x} = 2^(n-1), it returns n. Else it returns 0.
 @subsection Number theoretic functions
 
 @table @code
-@item uint32 gcd (uint32 a, uint32 b)
+@item uint32 gcd (unsigned long a, unsigned long b)
 @cindex @code{gcd ()}
 @itemx cl_I gcd (const cl_I& a, const cl_I& b)
 This function returns the greatest common divisor of @code{a} and @code{b},
@@ -1966,6 +1947,29 @@ normalized to be >= 0.
 @code{a} must be > 0. @code{b} must be >0 and != 1. If log(a,b) is
 rational number, this function returns true and sets *l = log(a,b), else
 it returns false.
+
+@item int jacobi (signed long a, signed long b)
+@cindex @code{jacobi()}
+@itemx int jacobi (const cl_I& a, const cl_I& b)
+Returns the Jacobi symbol 
+@tex 
+$\left({a\over b}\right)$,
+@end tex
+@ifnottex 
+(a/b),
+@end ifnottex
+@code{a,b} must be integers, @code{b>0} and odd. The result is 0
+iff gcd(a,b)>1.
+
+@item cl_boolean isprobprime (const cl_I& n)
+@cindex prime
+@cindex @code{isprobprime()}
+Returns true if @code{n} is a small prime or passes the Miller-Rabin 
+primality test. The probability of a false positive is 1:10^30.
+
+@item cl_I nextprobprime (const cl_R& x)
+@cindex @code{nextprobprime()}
+Returns the smallest probable prime >=@code{x}.
 @end table
 
 
@@ -2008,7 +2012,7 @@ Each of the classes
 defines the following operations.
 
 @table @code
-@item @var{type} scale_float (const @var{type}& x, sintL delta)
+@item @var{type} scale_float (const @var{type}& x, sintC delta)
 @cindex @code{scale_float ()}
 @itemx @var{type} scale_float (const @var{type}& x, const cl_I& delta)
 Returns @code{x*2^delta}. This is more efficient than an explicit multiplication
@@ -2034,13 +2038,13 @@ Returns the base of the floating-point representation. This is always @code{2}.
 Returns the sign @code{s} of @code{x} as a float. The value is 1 for
 @code{x} >= 0, -1 for @code{x} < 0.
 
-@item uintL float_digits (const @var{type}& x)
+@item uintC float_digits (const @var{type}& x)
 @cindex @code{float_digits ()}
 Returns the number of mantissa bits in the floating-point representation
 of @code{x}, including the hidden bit. The value only depends on the type
 of @code{x}, not on its value.
 
-@item uintL float_precision (const @var{type}& x)
+@item uintC float_precision (const @var{type}& x)
 @cindex @code{float_precision ()}
 Returns the number of significant mantissa bits in the floating-point
 representation of @code{x}. Since denormalized numbers are not supported,
@@ -2108,19 +2112,19 @@ zero, it is treated as positive. Same for @code{y}.
 
 @subsection Conversion to floating-point numbers
 
-The type @code{cl_float_format_t} describes a floating-point format.
-@cindex @code{cl_float_format_t}
+The type @code{float_format_t} describes a floating-point format.
+@cindex @code{float_format_t}
 
 @table @code
-@item cl_float_format_t cl_float_format (uintL n)
-@cindex @code{cl_float_format ()}
+@item float_format_t float_format (uintL n)
+@cindex @code{float_format ()}
 Returns the smallest float format which guarantees at least @code{n}
 decimal digits in the mantissa (after the decimal point).
 
-@item cl_float_format_t cl_float_format (const cl_F& x)
+@item float_format_t float_format (const cl_F& x)
 Returns the floating point format of @code{x}.
 
-@item cl_float_format_t default_float_format
+@item float_format_t default_float_format
 @cindex @code{default_float_format}
 Global variable: the default float format used when converting rational numbers
 to floats.
@@ -2132,7 +2136,7 @@ To convert a real number to a float, each of the types
 defines the following operations:
 
 @table @code
-@item cl_F cl_float (const @var{type}&x, cl_float_format_t f)
+@item cl_F cl_float (const @var{type}&x, float_format_t f)
 @cindex @code{cl_float ()}
 Returns @code{x} as a float of format @code{f}.
 @item cl_F cl_float (const @var{type}&x, const cl_F& y)
@@ -2147,29 +2151,29 @@ Of course, converting a number to a float can lose precision.
 Every floating-point format has some characteristic numbers:
 
 @table @code
-@item cl_F most_positive_float (cl_float_format_t f)
+@item cl_F most_positive_float (float_format_t f)
 @cindex @code{most_positive_float ()}
 Returns the largest (most positive) floating point number in float format @code{f}.
 
-@item cl_F most_negative_float (cl_float_format_t f)
+@item cl_F most_negative_float (float_format_t f)
 @cindex @code{most_negative_float ()}
 Returns the smallest (most negative) floating point number in float format @code{f}.
 
-@item cl_F least_positive_float (cl_float_format_t f)
+@item cl_F least_positive_float (float_format_t f)
 @cindex @code{least_positive_float ()}
 Returns the least positive floating point number (i.e. > 0 but closest to 0)
 in float format @code{f}.
 
-@item cl_F least_negative_float (cl_float_format_t f)
+@item cl_F least_negative_float (float_format_t f)
 @cindex @code{least_negative_float ()}
 Returns the least negative floating point number (i.e. < 0 but closest to 0)
 in float format @code{f}.
 
-@item cl_F float_epsilon (cl_float_format_t f)
+@item cl_F float_epsilon (float_format_t f)
 @cindex @code{float_epsilon ()}
 Returns the smallest floating point number e > 0 such that @code{1+e != 1}.
 
-@item cl_F float_negative_epsilon (cl_float_format_t f)
+@item cl_F float_negative_epsilon (float_format_t f)
 @cindex @code{float_negative_epsilon ()}
 Returns the smallest floating point number e > 0 such that @code{1-e != 1}.
 @end table
@@ -2390,7 +2394,7 @@ The exponent marker is
 or @samp{e}, which denotes a default float format. The precision specifying
 suffix has the syntax _@var{prec} where @var{prec} denotes the number of
 valid mantissa digits (in decimal, excluding leading zeroes), cf. also
-function @samp{cl_float_format}.
+function @samp{float_format}.
 
 @item Complex numbers
 External representation:
@@ -2410,25 +2414,15 @@ In Common Lisp notation: @code{#C(@var{realpart} @var{imagpart})}.
 
 @section Input functions
 
-Including @code{<cln/io.h>} defines a type @code{cl_istream}, which is
-the type of the first argument to all input functions. @code{cl_istream}
-is the same as @code{std::istream&}.
-
-The variable
-@itemize @asis
-@item
-@code{cl_istream stdin}
-@end itemize
-contains the standard input stream.
-
-These are the simple input functions:
+Including @code{<cln/io.h>} defines a number of simple input functions
+that read from @code{std::istream&}:
 
 @table @code
-@item int freadchar (cl_istream stream)
+@item int freadchar (std::istream& stream)
 Reads a character from @code{stream}. Returns @code{cl_EOF} (not a @samp{char}!)
 if the end of stream was encountered or an error occurred.
 
-@item int funreadchar (cl_istream stream, int c)
+@item int funreadchar (std::istream& stream, int c)
 Puts back @code{c} onto @code{stream}. @code{c} must be the result of the
 last @code{freadchar} operation on @code{stream}.
 @end table
@@ -2438,7 +2432,7 @@ Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
 defines, in @code{<cln/@var{type}_io.h>}, the following input function:
 
 @table @code
-@item cl_istream operator>> (cl_istream stream, @var{type}& result)
+@item std::istream& operator>> (std::istream& stream, @var{type}& result)
 Reads a number from @code{stream} and stores it in the @code{result}.
 @end table
 
@@ -2446,11 +2440,11 @@ The most flexible input functions, defined in @code{<cln/@var{type}_io.h>},
 are the following:
 
 @table @code
-@item cl_N read_complex (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_R read_real (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_F read_float (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_RA read_rational (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_I read_integer (cl_istream stream, const cl_read_flags& flags)
+@item cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_R read_real (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_F read_float (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
 Reads a number from @code{stream}. The @code{flags} are parameters which
 affect the input syntax. Whitespace before the number is silently skipped.
 
@@ -2501,10 +2495,10 @@ accept all of these extensions.
 @item unsigned int rational_base
 The base in which rational numbers are read.
 
-@item cl_float_format_t float_flags.default_float_format
+@item float_format_t float_flags.default_float_format
 The float format used when reading floats with exponent marker @samp{e}.
 
-@item cl_float_format_t float_flags.default_lfloat_format
+@item float_format_t float_flags.default_lfloat_format
 The float format used when reading floats with exponent marker @samp{l}.
 
 @item cl_boolean float_flags.mantissa_dependent_float_format
@@ -2516,46 +2510,29 @@ precision corresponding to their number of significant digits.
 
 @section Output functions
 
-Including @code{<cln/io.h>} defines a type @code{cl_ostream}, which is
-the type of the first argument to all output functions. @code{cl_ostream}
-is the same as @code{std::ostream&}.
-
-The variable
-@itemize @asis
-@item
-@code{cl_ostream stdout}
-@end itemize
-contains the standard output stream.
-
-The variable
-@itemize @asis
-@item
-@code{cl_ostream stderr}
-@end itemize
-contains the standard error output stream.
-
-These are the simple output functions:
+Including @code{<cln/io.h>} defines a number of simple output functions
+that write to @code{std::ostream&}:
 
 @table @code
-@item void fprintchar (cl_ostream stream, char c)
+@item void fprintchar (std::ostream& stream, char c)
 Prints the character @code{x} literally on the @code{stream}.
 
-@item void fprint (cl_ostream stream, const char * string)
+@item void fprint (std::ostream& stream, const char * string)
 Prints the @code{string} literally on the @code{stream}.
 
-@item void fprintdecimal (cl_ostream stream, int x)
-@itemx void fprintdecimal (cl_ostream stream, const cl_I& x)
+@item void fprintdecimal (std::ostream& stream, int x)
+@itemx void fprintdecimal (std::ostream& stream, const cl_I& x)
 Prints the integer @code{x} in decimal on the @code{stream}.
 
-@item void fprintbinary (cl_ostream stream, const cl_I& x)
+@item void fprintbinary (std::ostream& stream, const cl_I& x)
 Prints the integer @code{x} in binary (base 2, without prefix)
 on the @code{stream}.
 
-@item void fprintoctal (cl_ostream stream, const cl_I& x)
+@item void fprintoctal (std::ostream& stream, const cl_I& x)
 Prints the integer @code{x} in octal (base 8, without prefix)
 on the @code{stream}.
 
-@item void fprinthexadecimal (cl_ostream stream, const cl_I& x)
+@item void fprinthexadecimal (std::ostream& stream, const cl_I& x)
 Prints the integer @code{x} in hexadecimal (base 16, without prefix)
 on the @code{stream}.
 @end table
@@ -2565,8 +2542,8 @@ Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
 defines, in @code{<cln/@var{type}_io.h>}, the following output functions:
 
 @table @code
-@item void fprint (cl_ostream stream, const @var{type}& x)
-@itemx cl_ostream operator<< (cl_ostream stream, const @var{type}& x)
+@item void fprint (std::ostream& stream, const @var{type}& x)
+@itemx std::ostream& operator<< (std::ostream& stream, const @var{type}& x)
 Prints the number @code{x} on the @code{stream}. The output may depend
 on the global printer settings in the variable @code{default_print_flags}.
 The @code{ostream} flags and settings (flags, width and locale) are
@@ -2576,15 +2553,15 @@ ignored.
 The most flexible output function, defined in @code{<cln/@var{type}_io.h>},
 are the following:
 @example
-void print_complex  (cl_ostream stream, const cl_print_flags& flags,
+void print_complex  (std::ostream& stream, const cl_print_flags& flags,
                      const cl_N& z);
-void print_real     (cl_ostream stream, const cl_print_flags& flags,
+void print_real     (std::ostream& stream, const cl_print_flags& flags,
                      const cl_R& z);
-void print_float    (cl_ostream stream, const cl_print_flags& flags,
+void print_float    (std::ostream& stream, const cl_print_flags& flags,
                      const cl_F& z);
-void print_rational (cl_ostream stream, const cl_print_flags& flags,
+void print_rational (std::ostream& stream, const cl_print_flags& flags,
                      const cl_RA& z);
-void print_integer  (cl_ostream stream, const cl_print_flags& flags,
+void print_integer  (std::ostream& stream, const cl_print_flags& flags,
                      const cl_I& z);
 @end example
 Prints the number @code{x} on the @code{stream}. The @code{flags} are
@@ -2605,9 +2582,9 @@ prefixes, trailing dot). Default is false.
 If this flag is true, type specific exponent markers have precedence over 'E'.
 Default is false.
 
-@item cl_float_format_t default_float_format
+@item float_format_t default_float_format
 Floating point numbers of this format will be printed using the 'E' exponent
-marker. Default is @code{cl_float_format_ffloat}.
+marker. Default is @code{float_format_ffloat}.
 
 @item cl_boolean complex_readably
 If this flag is true, complex numbers will be printed using the Common Lisp
@@ -2643,7 +2620,7 @@ These compare two rings for equality.
 Given a ring @code{R}, the following members can be used.
 
 @table @code
-@item void R->fprint (cl_ostream stream, const cl_ring_element& x)
+@item void R->fprint (std::ostream& stream, const cl_ring_element& x)
 @cindex @code{fprint ()}
 @itemx cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y)
 @cindex @code{equal ()}
@@ -2865,9 +2842,9 @@ The following output functions are defined (see also the chapter on
 input/output).
 
 @table @code
-@item void fprint (cl_ostream stream, const cl_MI& x)
+@item void fprint (std::ostream& stream, const cl_MI& x)
 @cindex @code{fprint ()}
-@itemx cl_ostream operator<< (cl_ostream stream, const cl_MI& x)
+@itemx std::ostream& operator<< (std::ostream& stream, const cl_MI& x)
 @cindex @code{operator << ()}
 Prints the modular integer @code{x} on the @code{stream}. The output may depend
 on the global printer settings in the variable @code{default_print_flags}.
@@ -3085,7 +3062,7 @@ This returns @code{0 in R}, a polynomial of degree -1.
 
 @item cl_UP R->one()
 @cindex @code{one ()}
-This returns @code{1 in R}, a polynomial of degree <= 0.
+This returns @code{1 in R}, a polynomial of degree == 0.
 
 @item cl_UP R->canonhom (const cl_I& x)
 @cindex @code{canonhom ()}
@@ -3167,6 +3144,11 @@ Returns true if @code{x} is @code{0 in R}.
 @cindex @code{degree ()}
 Returns the degree of the polynomial. The zero polynomial has degree @code{-1}.
 
+@item sintL ldegree (const cl_UP& x)
+@cindex @code{degree ()}
+Returns the low degree of the polynomial. This is the degree of the first
+non-vanishing polynomial coefficient. The zero polynomial has ldegree @code{-1}.
+
 @item cl_ring_element coeff (const cl_UP& x, uintL index)
 @cindex @code{coeff ()}
 Returns the coefficient of @code{X^index} in the polynomial @code{x}.
@@ -3187,9 +3169,9 @@ The following output functions are defined (see also the chapter on
 input/output).
 
 @table @code
-@item void fprint (cl_ostream stream, const cl_UP& x)
+@item void fprint (std::ostream& stream, const cl_UP& x)
 @cindex @code{fprint ()}
-@itemx cl_ostream operator<< (cl_ostream stream, const cl_UP& x)
+@itemx std::ostream& operator<< (std::ostream& stream, const cl_UP& x)
 @cindex @code{operator << ()}
 Prints the univariate polynomial @code{x} on the @code{stream}. The output may
 depend on the global printer settings in the variable
@@ -3281,6 +3263,7 @@ Garbage collection: A reference counting mechanism makes sure that any
 number object's storage is freed immediately when the last reference to the
 object is gone.
 @item
+@cindex immediate numbers
 Small integers are represented as immediate values instead of pointers
 to heap allocated storage. This means that integers @code{> -2^29},
 @code{< 2^29} don't consume heap memory, unless they were explicitly allocated
@@ -3322,8 +3305,8 @@ Sch{@"o}nhage-Strassen
 @cindex Sch{@"o}nhage-Strassen multiplication
 @end iftex
 @ifinfo
-Schönhage-Strassen
-@cindex Schönhage-Strassen multiplication
+Schnhage-Strassen
+@cindex Schnhage-Strassen multiplication
 @end ifinfo
 multiplication, which is an asymptotically optimal multiplication 
 algorithm.
@@ -3382,6 +3365,42 @@ need special flags for compiling. The library has been installed to a
 public directory as well (normally @code{/usr/local/lib}), hence when
 linking a CLN application it is sufficient to give the flag @code{-lcln}.
 
+Since CLN version 1.1, there are two tools to make the creation of
+software packages that use CLN easier:
+@itemize @bullet
+@item
+@cindex @code{cln-config}
+@code{cln-config} is a shell script that you can use to determine the
+compiler and linker command line options required to compile and link a
+program with CLN.  Start it with @code{--help} to learn about its options
+or consult the manpage that comes with it.
+@item
+@cindex @code{AC_PATH_CLN}
+@code{AC_PATH_CLN} is for packages configured using GNU automake.
+The synopsis is:
+@example
+@code{AC_PATH_CLN([@var{MIN-VERSION}, [@var{ACTION-IF-FOUND} [, @var{ACTION-IF-NOT-FOUND}]]])}
+@end example
+This macro determines the location of CLN using @code{cln-config}, which
+is either found in the user's path, or from the environment variable
+@code{CLN_CONFIG}.  It tests the installed libraries to make sure that
+their version is not earlier than @var{MIN-VERSION} (a default version
+will be used if not specified). If the required version was found, sets
+the @env{CLN_CPPFLAGS} and the @env{CLN_LIBS} variables. This
+macro is in the file @file{cln.m4} which is installed in
+@file{$datadir/aclocal}. Note that if automake was installed with a
+different @samp{--prefix} than CLN, you will either have to manually
+move @file{cln.m4} to automake's @file{$datadir/aclocal}, or give
+aclocal the @samp{-I} option when running it. Here is a possible example
+to be included in your package's @file{configure.ac}:
+@example
+AC_PATH_CLN(1.1.0, [
+  LIBS="$LIBS $CLN_LIBS"
+  CPPFLAGS="$CPPFLAGS $CLN_CPPFLAGS"
+], AC_MSG_ERROR([No suitable installed version of CLN could be found.]))
+@end example
+@end itemize
+
 
 @section Compatibility to old CLN versions
 @cindex namespace
@@ -3560,7 +3579,7 @@ using namespace cln;
 const cl_I fibonacci (int n)
 @{
         // Need a precision of ((1+sqrt(5))/2)^-n.
-        cl_float_format_t prec = cl_float_format((int)(0.208987641*n+5));
+        float_format_t prec = float_format((int)(0.208987641*n+5));
         cl_R sqrt5 = sqrt(cl_float(5,prec));
         cl_R phi = (1+sqrt5)/2;
         return round1( expt(phi,n)/sqrt5 );
@@ -3572,8 +3591,9 @@ Let's explain what is going on in detail.
 The include file @code{<cln/integer.h>} is necessary because the type
 @code{cl_I} is used in the function, and the include file @code{<cln/real.h>}
 is needed for the type @code{cl_R} and the floating point number functions.
-The order of the include files does not matter.  In order not to write out
-@code{cln::}@var{foo} we can safely import the whole namespace @code{cln}.
+The order of the include files does not matter.  In order not to write
+out @code{cln::}@var{foo} in this simple example we can safely import
+the whole namespace @code{cln}.
 
 Then comes the function declaration. The argument is an @code{int}, the
 result an integer. The return type is defined as @samp{const cl_I}, not
@@ -3755,8 +3775,4 @@ global variables.
 @printindex my
 
 
-@c Table of contents
-@contents
-
-
 @bye