Floating-point numbers

Version &Version; Integration of mpfr, mpfi, mpc, fplll and cxsc in GAP
Laurent Bartholdi laurent.bartholdi@gmail.com laurent.bartholdi@gmail.com https://www.math.uni-sb.de/ag/bartholdi/
&Date;

      FR Mathematik
    D-66041 Saarbrücken
    Germany

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

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

This documentation for Float is available at https://www.gap-system.org/Manuals/pkg/float-&Version;/doc/manual.pdf in PDF format, and may be accessed online at https://gap-packages.github.io/float/.

The latest release of the package may be downloaded as https://github.com/gap-packages/float/releases/download/v&Version;/float-&Version;.tar.gz (tar, gzipped). The latest repository version (possibly unstable) may be downloaded as https://github.com/gap-packages/float/tarball/master (tar, gzipped), https://github.com/gap-packages/float.git (git repository), https://packages.debian.org/search?keywords=gap-float&searchon=names&suite=all&section=all (debian package), or explored at https://github.com/gap-packages/float/tree/master/.

For comments or questions on Float please contact the author.
©right; 2011-2021 by Laurent Bartholdi
Part of this work was 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 https://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.7.0 ... 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> r2 := Sqrt(2.0); .141421e1(99) gap> MinimalPolynomial(Rationals,r2); -2*x_1^2+1 gap> Cyc(r2); E(8)-E(8)^3 gap> gap> SetFloats(MPC); # complex numbers gap> z := 5.0-1.0i; .5e1-.1e1i gap> (1+1.0i)*last^4*(239+1.0i); .228488e6 gap> Exp(6.2835i); .1e1+.314693e-3i
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. A "pseudo-field" of floating-point numbers is available to create them using the standard &GAP; syntax.

The "pseudo-field" of floating-point numbers, containing all floating-point numbers in the current implementation.

Note that it is not really a field, e.g. because addition of floating-point numbers is not associative. It is mainly used to create indeterminates, as in the following example:
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">