gnu: Add emacs-helm-flycheck.
[guix.git] / gnu / packages / multiprecision.scm
blobe185a983595a2965efd521969cc11c1c2ac804e6
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015, 2018 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
7 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
9 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages multiprecision)
27   #:use-module (guix licenses)
28   #:use-module (gnu packages)
29   #:use-module (gnu packages m4)
30   #:use-module (gnu packages gcc)
31   #:use-module (guix packages)
32   #:use-module (guix download)
33   #:use-module (guix utils)
34   #:use-module (guix build-system gnu))
36 (define-public gmp
37   (package
38    (name "gmp")
39    (version "6.1.2")
40    (source (origin
41             (method url-fetch)
42             (uri
43              (string-append "mirror://gnu/gmp/gmp-"
44                             version ".tar.xz"))
45             (sha256
46              (base32
47               "04hrwahdxyqdik559604r7wrj9ffklwvipgfxgj4ys4skbl6bdc7"))
48             (patches (search-patches "gmp-faulty-test.patch"))))
49    (build-system gnu-build-system)
50    (native-inputs `(("m4" ,m4)))
51    (outputs '("out" "debug"))
52    (arguments `(#:parallel-tests? #f ; mpz/reuse fails otherwise
53                 #:configure-flags
54                 '(;; Build a "fat binary", with routines for several
55                   ;; sub-architectures.
56                   "--enable-fat"
57                   "--enable-cxx"
58                   ,@(cond ((target-mingw?)
59                            ;; Static and shared cannot be built in one go:
60                            ;; they produce different headers.  We need shared.
61                            `("--disable-static"
62                              "--enable-shared"))
63                           (else '())))))
64    (synopsis "Multiple-precision arithmetic library")
65    (description
66     "@dfn{GMP} (the GNU Multiple Precision Arithmetic Library) is a library for
67 arbitrary-precision arithmetic, operating on signed integers, rational numbers
68 and floating point numbers.  The precision is only limited by the available
69 memory.  The library is highly optimized, with a design focus on execution
70 speed.  It is aimed at use in, for example, cryptography and computational
71 algebra.")
72    (license lgpl3+)
73    (home-page "https://gmplib.org/")))
75 (define-public gmp-6.0
76   ;; We keep this one around to bootstrap GCC, to work around a compilation
77   ;; issue on ARM.  See
78   ;; <https://gmplib.org/list-archives/gmp-bugs/2015-December/003848.html>.
79   (package
80     (inherit gmp)
81     (version "6.0.0a")
82     (source (origin
83               (method url-fetch)
84               (uri (string-append "mirror://gnu/gmp/gmp-"
85                                   version ".tar.xz"))
86               (sha256
87                (base32
88                 "0r5pp27cy7ch3dg5v0rsny8bib1zfvrza6027g2mp5f6v8pd6mli"))
89               (patches (search-patches "gmp-arm-asm-nothumb.patch"
90                                        "gmp-faulty-test.patch"))))))
92 (define-public mpfr
93   (package
94    (name "mpfr")
95    (version "4.0.1")
96    (source (origin
97             (method url-fetch)
98             (uri (string-append "mirror://gnu/mpfr/mpfr-" version
99                                 ".tar.xz"))
100             (sha256 (base32
101                      "0vp1lrc08gcmwdaqck6bpzllkrykvp06vz5gnqpyw0v3h9h4m1v7"))))
102    (build-system gnu-build-system)
103    (outputs '("out" "debug"))
104    (propagated-inputs `(("gmp" ,gmp)))            ; <mpfr.h> refers to <gmp.h>
105    (synopsis "C library for arbitrary-precision floating-point arithmetic")
106    (description
107     "GNU@tie{}@dfn{MPFR} (Multiple Precision Floating-Point Reliably) is a C
108 library for performing multiple-precision, floating-point computations with
109 correct rounding.")
110    (license lgpl3+)
111    (home-page "http://www.mpfr.org/")))
113 (define-public mpc
114   (package
115    (name "mpc")
116    (version "1.1.0")
117    (source (origin
118             (method url-fetch)
119             (uri (string-append
120                   "mirror://gnu/mpc/mpc-" version ".tar.gz"))
121             (sha256
122               (base32
123                 "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9"))))
124    (build-system gnu-build-system)
125    (outputs '("out" "debug"))
126    (propagated-inputs `(("gmp" ,gmp)              ; <mpc.h> refers to both
127                         ("mpfr" ,mpfr)))
128    (synopsis "C library for arbitrary-precision complex arithmetic")
129    (description
130     "GNU@tie{}@dfn{MPC} (Multiple Precision Complex library) is a C library for
131 performing arithmetic on complex numbers.  It supports arbitrarily high
132 precision and correctly rounds the results.")
133    (license lgpl3+)
134    (home-page "http://multiprecision.org/mpc/")))
136 (define-public mpfi
137   (package
138     (name "mpfi")
139     (version "1.5.3")
140     (source
141      (origin
142        (method url-fetch)
143        (uri (string-append "https://gforge.inria.fr/frs/download.php"
144                            "/latestfile/181/" name "-" version ".tar.bz2"))
145        (sha256
146         (base32 "0bqr8yibl7jbrp0bw7xk1lm7nis7rv26jsz6y8ycvih8n9bx90r3"))))
147     (build-system gnu-build-system)
148     (propagated-inputs `(("gmp" ,gmp)   ; <mpfi.h> refers to both
149                          ("mpfr" ,mpfr)))
150     (synopsis "C library for arbitrary-precision interval arithmetic")
151     (description
152      "@dfn{MPFI} (Multiple Precision Floating-point Interval) is a portable C
153 library for arbitrary-precision interval arithmetic, with intervals represented
154 using MPFR reliable floating-point numbers.  It's based on the @dfn{GMP} (GNU
155 Multiple Precision Arithmetic) and GNU@tie{}@dfn{MPFR} (Multiple Precision
156 Floating-Point Reliably) libraries.
158 The purpose of arbitrary-precision interval arithmetic is to get results that
159 are both guaranteed, thanks to interval computation, and accurate, thanks to
160 multiple-precision arithmetic.")
161     (license lgpl2.1+)
162     (home-page "https://perso.ens-lyon.fr/nathalie.revol/software.html")))
164 (define-public irram
165   (package
166     (name "irram")
167     (version "2013_01")
168     (source
169      (origin
170        (method url-fetch)
171        (uri (string-append "http://irram.uni-trier.de/irram-files/iRRAM_"
172                            version ".tar.bz2"))
173        (sha256
174         (base32 "1cdmvb4hsa161rfdjqyhd9sb3fcr43p3a6nsj7cb4kn9f94qmjpj"))))
175     (build-system gnu-build-system)
176     (propagated-inputs `(("gmp" ,gmp)   ; <mpfi.h> refers to both
177                          ("mpfr" ,mpfr)))
178     (arguments
179      `(#:parallel-build? #f))
180     (synopsis "C++ package for real arithmetic based on the Real-RAM concept")
181     (description
182      "@dfn{iRRAM} is a C++ package for error-free real arithmetic based on
183 the concept of a Real-RAM.  Its capabilities range from ordinary arithmetic
184 over trigonometric functions to linear algebra and differential
185 equations.  A program using iRRAM is coded in ordinary C++, but may use a
186 special class that behaves like real numbers without any
187 error.  Additionally, iRRAM uses the concept of multi-valued functions.")
188     (license lgpl2.0+)
189     (home-page "http://irram.uni-trier.de/")))
191 (define-public qd
192   (package
193     (name "qd")
194     (version "2.3.18")
195     (source (origin
196               (method url-fetch)
197               (uri (string-append "http://crd.lbl.gov/~dhbailey/mpdist/qd-"
198                                   version ".tar.gz"))
199               (sha256
200                (base32
201                 "0vkihcj9fyv2cycq8515713gbs3yskhmivy8bznvx72i6ddnn2c1"))))
202     (build-system gnu-build-system)
203     (native-inputs
204      `(("gfortran" ,gfortran)))
205     (arguments
206      `(#:configure-flags `("--disable-enable_fma" ;weird :/
207                            "--enable-shared"
208                            ,,@(if (string-prefix? "aarch64"
209                                                   (or (%current-target-system)
210                                                       (%current-system)))
211                                   ;; XXX: The qd_test test fails numerical
212                                   ;; accuracy checks for 'dd_real::exp()' on
213                                   ;; aarch64 with GCC 5.4 at -O2.  Disabling
214                                   ;; expensive optimizations lets it pass.
215                                   '("CXXFLAGS=-O3 -fno-expensive-optimizations")
216                                   '("CXXFLAGS=-O3")))))
217     (home-page "http://crd-legacy.lbl.gov/~dhbailey/mpdist/")
218     (synopsis "Double-double and quad-double library")
219     (description "This package supports both a double-double
220 datatype (approx. 32 decimal digits) and a quad-double datatype (approx. 64
221 decimal digits).  The computational library is written in C++.  Both C++ and
222 Fortran-90 high-level language interfaces are provided to permit one to
223 convert an existing C++ or Fortran-90 program to use the library with only
224 minor changes to the source code.  In most cases only a few type statements
225 and (for Fortran-90 programs) read/write statements need to be changed.  PSLQ
226 and numerical quadrature programs are included.")
227     (license bsd-3)))