Floating-point numbers

Version &Version; MPFR- and CXSC-based library for GAP
Laurent Bartholdi laurent dot bartholdi at gmail dot com laurent.bartholdi@gmail.com http://www.uni-math.gwdg.de/laurent/
&Date;

      Mathematisches Institut
    Bunsenstraße 3-5
    D-37073 Göttingen
    Germany

This document describes the package Float, which implements in &GAP; arbitrary-precision floating-point numbers.

The computer algebra system &GAP; is available at http://gap-system.org.

This documentation for Float is available at http://laurentbartholdi.github.com/float/manual.pdf in PDF format, and may be accessed online at http://laurentbartholdi.github.com/float/.

The latest release of the package may be downloaded as http://www.uni-math.gwdg.de/laurent/archive/float-&Version;.tar.gz (tar, gzipped). The latest repository version (possibly unstable) may be downloaded as https://github.com/laurentbartholdi/float/tarball/master (tar, gzipped), https://github.com/laurentbartholdi/float.git (git repository), or explored at https://github.com/laurentbartholdi/float/tree/master/.

For comments or questions on Float please contact the author.
©right; 2011-2014 by Laurent Bartholdi
Part of this work is supported by the "Swiss National Fund for Scientific Research (SNF)", the "German National Science Foundation (DFG)", and the Courant Research Centre "Higher Order Structures" of the University of Göttingen.
Licensing This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program, in the file COPYING. If not, see http://www.gnu.org/licenses/.
Float package
A sample run The extended floating-point capabilities of &GAP; are installed by loading the package via LoadPackage("float"); and selecting new floating-point handlers via SetFloats(MPFR), SetFloats(MPFI), SetFloats(MPC) orSetFloats(CXSC), depending on whether high-precision real, interval or complex arithmetic are desired, or whether a fast package containing all four real/complex element/interval arithmetic is desired:
gap> LoadPackage("float"); Loading FLOAT 0.3 ... true gap> SetFloats(MPFR); # floating-point gap> x := 4*Atan(1.0); .314159e1 gap> Sin(x); .169569e-30 gap> SetFloats(MPFR,1000); # 1000 bits gap> x := 4*Atan(1.0); .314159e1 gap> Sin(x); .125154e-300 gap> String(x,300); ".3141592653589793238462643383279502884197169399375105820974944592307816406286\ 208998628034825342117067982148086513282306647093844609550582231725359408128481\ 117450284102701938521105559644622948954930381964428810975665933446128475648233\ 78678316527120190914564856692346034861045432664821339360726024914127e1" gap> gap> SetFloats(MPFI); # intervals gap> x := 4*Atan(1.0); .314159e1(99) gap> AbsoluteDiameter(x); Sup(x); Inf(x); .100441e-29 .314159e1 .314159e1 gap> Sin(x); -.140815e-29(97) gap> 0.0 in last; true gap> 1.0; # exact representation .1e1(∞) gap> IncreaseInterval(last,0.001); # now only 8 significant bits .1e1(8) gap> IncreaseInterval(last,-0.002); # now becomes empty ∅ gap> MinimalPolynomial(Rationals,Sqrt(2.0)); -2*x_1^2+1 gap> Cyc(last); E(8)-E(8)^3 gap> gap> SetFloats(MPC); # complex numbers
Polynomials
The Floats pseudo-field Polynomials with floating-point coefficients may be manipulated in &GAP;; though they behave, in subtle ways, quite differently than polynomials over rings.

The "pseudo-field" of floating-point numbers is an object in &GAP;, called FLOAT_PSEUDOFIELD. (It is not really a field, e.g. because addition of floating-point numbers in not associative). It may be used to create indeterminates, for example as
gap> x := Indeterminate(FLOAT_PSEUDOFIELD,"x"); x gap> 2*x^2+3; 2.0*x^2+3.0 gap> Value(last,10); 203.0
Roots of polynomials The Jenkins-Traub algorithm has been implemented, in arbitrary precision for MPFR and MPC.

Furthermore, CXSC can provide complex enclosures for the roots of a complex polynomial.
Finding integer relations <#Include Label="PSLQ">
LLL lattice reduction A faster implementation of the LLL lattice reduction algorithm has also been implemented. It is accessible via the commands FPLLLReducedBasis(m) and FPLLLShortestVector(m).

Implemented packages
MPFR <#Include Label="IsMPFRFloat">
MPFI <#Include Label="IsMPFIFloat">
MPC <#Include Label="IsMPCFloat">
CXSC <#Include Label="IsCXSCFloat">
FPLLL <#Include Label="FPLLL">