@synindex pg my
@synindex tp my
+@ifnottex
+@node Top
+@top CLN
+@end ifnottex
@c For `info' only.
-@ifinfo
-This file documents @sc{cln}, a Class Library for Numbers.
+@ifnottex
+This manual documents @sc{cln}, a Class Library for Numbers.
Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
Richard B. Kreckel, @code{<kreckel@@ginac.de>}.
Copyright (C) Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
-Copyright (C) Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
+Copyright (C) Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2017.
+Copyright (C) Alexei Sheplyakov 2008, 2010.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the author.
-@end ifinfo
+@end ifnottex
@c For TeX only.
@vskip 0pt plus 1filll
Copyright @copyright{} Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
@sp 0
-Copyright @copyright{} Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
+Copyright @copyright{} Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014.
+@sp 0
+Copyright @copyright{} Alexei Sheplyakov 2008, 2010.
@sp 2
Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
@contents
@end iftex
-@ifinfo
-@node Top
-@top CLN
-@end ifinfo
-
@menu
* Introduction::
* Customizing::
* Index::
+@detailmenu
--- The Detailed Node Listing ---
Installation
* Customizing I/O::
* Customizing the memory allocator::
+@end detailmenu
@end menu
@node Introduction
@node C++ compiler
@subsection C++ compiler
-To build CLN, you need a C++ compiler.
-Actually, you need GNU @code{g++ 3.0.0} or newer.
+To build CLN, you need a C++11 compiler.
+GNU @code{g++ 4.8.1} or newer is recommended.
The following C++ features are used:
classes, member functions, overloading of functions and operators,
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.
-
@node Sed utility
@subsection Sed utility
@cindex @code{sed}
$ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
@end example
@example
-$ CC="gcc -V 3.2.3" CFLAGS="-O2 -finline-limit=1000" \
- CXX="g++ -V 3.2.3" CXXFLAGS="-O2 -finline-limit=1000" \
+$ CC=gcc CFLAGS="-O2 -finline-limit=1000" \
+ CXX=g++ CXXFLAGS="-O2 -finline-limit=1000" \
CPPFLAGS="-DNO_ASM" ./configure
@end example
@example
-$ CC="gcc-4.2" CFLAGS="-O2" CXX="g++-4.2" CXXFLAGS="-O2" ./configure
+$ CC="gcc-9" CFLAGS="-O2" CXX="g++-9" CXXFLAGS="-O2" ./configure
@end example
Note that for these environment variables to take effect, you have to set
We have the relations
-@itemize @asis
+@itemize @w{}
@item
@code{x = complex(realpart(x), imagpart(x))}
@item
The functions are related like this:
-@itemize @asis
+@itemize @w{}
@item
@code{ceiling(m/n) = floor((m+n-1)/n) = floor((m-1)/n)+1}
for rational numbers @code{m/n} (@code{m}, @code{n} integers, @code{n}>0), and
The following relations hold:
-@itemize @asis
+@itemize @w{}
@item
@code{ldb (n, b) = mask_field(n, b) >> b.position},
@item
If @code{x} is any float, one has
-@itemize @asis
+@itemize @w{}
@item
@code{cl_float(rational(x),x) = x}
@item
@var{expmarker} @var{expsign} @{@var{digit}@}+.
The exponent marker is
-@itemize @asis
+@itemize @w{}
@item
@samp{s} for short-floats,
@item
@item Complex numbers
External representation:
-@itemize @asis
+@itemize @w{}
@item
In algebraic notation: @code{@var{realpart}+@var{imagpart}i}. Of course,
if @var{imagpart} is negative, its printed representation begins with
@node Input functions
@section 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 (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 (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
-
-Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
-@code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
-defines, in @code{<cln/@var{type}_io.h>}, the following input function:
-
-@table @code
-@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
-
-The most flexible input functions, defined in @code{<cln/@var{type}_io.h>},
-are the following:
+Including @code{<cln/io.h>} defines flexible input functions:
@table @code
@item cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
@item operator =
Assignment from @code{cl_string} and @code{const char *}.
-@item s.length()
-@cindex @code{length ()}
+@item s.size()
+@cindex @code{size()}
@itemx strlen(s)
@cindex @code{strlen ()}
Returns the length of the string @code{s}.
@item s[i]
@cindex @code{operator [] ()}
Returns the @code{i}th character of the string @code{s}.
-@code{i} must be in the range @code{0 <= i < s.length()}.
+@code{i} must be in the range @code{0 <= i < s.size()}.
@item bool equal (const cl_string& s1, const cl_string& s2)
@cindex @code{equal ()}
This ensures that two calls of this function with the same arguments will
return the same polynomial ring.
-@itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)
+@item cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)
@cindex @code{find_univpoly_ring ()}
-@itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)
-@itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)
-@itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)
-@itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)
-@itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)
-@itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)
-@itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)
-@itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)
-@itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)
+@item cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)
+@item cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)
+@item cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)
+@item cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)
+@item cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)
+@item cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)
+@item cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)
+@item cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)
+@item cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)
These functions are equivalent to the general @code{find_univpoly_ring},
only the return type is more specific, according to the base ring's type.
@end table