Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / multiprecision.scm
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 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 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages multiprecision)
25 #:use-module (guix licenses)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages m4)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu))
32
33 (define-public gmp
34 (package
35 (name "gmp")
36 (version "6.1.2")
37 (source (origin
38 (method url-fetch)
39 (uri
40 (string-append "mirror://gnu/gmp/gmp-"
41 version ".tar.xz"))
42 (sha256
43 (base32
44 "04hrwahdxyqdik559604r7wrj9ffklwvipgfxgj4ys4skbl6bdc7"))
45 (patches (search-patches "gmp-faulty-test.patch"))))
46 (build-system gnu-build-system)
47 (native-inputs `(("m4" ,m4)))
48 (outputs '("out" "debug"))
49 (arguments `(#:parallel-tests? #f ; mpz/reuse fails otherwise
50 #:configure-flags
51 '(;; Build a "fat binary", with routines for several
52 ;; sub-architectures.
53 "--enable-fat"
54 "--enable-cxx"
55 ,@(cond ((target-mingw?)
56 ;; Static and shared cannot be built in one go:
57 ;; they produce different headers. We need shared.
58 `("--disable-static"
59 "--enable-shared"))
60 (else '())))))
61 (synopsis "Multiple-precision arithmetic library")
62 (description
63 "@dfn{GMP} (the GNU Multiple Precision Arithmetic Library) is a library for
64 arbitrary-precision arithmetic, operating on signed integers, rational numbers
65 and floating point numbers. The precision is only limited by the available
66 memory. The library is highly optimized, with a design focus on execution
67 speed. It is aimed at use in, for example, cryptography and computational
68 algebra.")
69 (license lgpl3+)
70 (home-page "https://gmplib.org/")))
71
72 (define-public gmp-6.0
73 ;; We keep this one around to bootstrap GCC, to work around a compilation
74 ;; issue on ARM. See
75 ;; <https://gmplib.org/list-archives/gmp-bugs/2015-December/003848.html>.
76 (package
77 (inherit gmp)
78 (version "6.0.0a")
79 (source (origin
80 (method url-fetch)
81 (uri (string-append "mirror://gnu/gmp/gmp-"
82 version ".tar.xz"))
83 (sha256
84 (base32
85 "0r5pp27cy7ch3dg5v0rsny8bib1zfvrza6027g2mp5f6v8pd6mli"))
86 (patches (search-patches "gmp-arm-asm-nothumb.patch"
87 "gmp-faulty-test.patch"))))))
88
89 (define-public mpfr
90 (package
91 (name "mpfr")
92 (version "3.1.6")
93 (source (origin
94 (method url-fetch)
95 (uri (string-append "mirror://gnu/mpfr/mpfr-" version
96 ".tar.xz"))
97 (sha256 (base32
98 "0l598h9klpgkz2bp0rxiqb90mkqh9f2f81n5rpy191j00hdaqqks"))))
99 (build-system gnu-build-system)
100 (outputs '("out" "debug"))
101 (propagated-inputs `(("gmp" ,gmp))) ; <mpfr.h> refers to <gmp.h>
102 (synopsis "C library for arbitrary-precision floating-point arithmetic")
103 (description
104 "GNU@tie{}@dfn{MPFR} (Multiple Precision Floating-Point Reliably) is a C
105 library for performing multiple-precision, floating-point computations with
106 correct rounding.")
107 (license lgpl3+)
108 (home-page "http://www.mpfr.org/")))
109
110 (define-public mpc
111 (package
112 (name "mpc")
113 (version "1.0.3")
114 (source (origin
115 (method url-fetch)
116 (uri (string-append
117 "mirror://gnu/mpc/mpc-" version ".tar.gz"))
118 (sha256
119 (base32
120 "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1"))))
121 (build-system gnu-build-system)
122 (outputs '("out" "debug"))
123 (propagated-inputs `(("gmp" ,gmp) ; <mpc.h> refers to both
124 ("mpfr" ,mpfr)))
125 (synopsis "C library for arbitrary-precision complex arithmetic")
126 (description
127 "GNU@tie{}@dfn{MPC} (Multiple Precision Complex library) is a C library for
128 performing arithmetic on complex numbers. It supports arbitrarily high
129 precision and correctly rounds the results.")
130 (license lgpl3+)
131 (home-page "http://multiprecision.org/mpc/")))
132
133 (define-public mpfi
134 (package
135 (name "mpfi")
136 (version "1.5.3")
137 (source
138 (origin
139 (method url-fetch)
140 (uri (string-append "https://gforge.inria.fr/frs/download.php"
141 "/latestfile/181/" name "-" version ".tar.bz2"))
142 (sha256
143 (base32 "0bqr8yibl7jbrp0bw7xk1lm7nis7rv26jsz6y8ycvih8n9bx90r3"))))
144 (build-system gnu-build-system)
145 (propagated-inputs `(("gmp" ,gmp) ; <mpfi.h> refers to both
146 ("mpfr" ,mpfr)))
147 (synopsis "C library for arbitrary-precision interval arithmetic")
148 (description
149 "@dfn{MPFI} (Multiple Precision Floating-point Interval) is a portable C
150 library for arbitrary-precision interval arithmetic, with intervals represented
151 using MPFR reliable floating-point numbers. It's based on the @dfn{GMP} (GNU
152 Multiple Precision Arithmetic) and GNU@tie{}@dfn{MPFR} (Multiple Precision
153 Floating-Point Reliably) libraries.
154
155 The purpose of arbitrary-precision interval arithmetic is to get results that
156 are both guaranteed, thanks to interval computation, and accurate, thanks to
157 multiple-precision arithmetic.")
158 (license lgpl2.1+)
159 (home-page "https://perso.ens-lyon.fr/nathalie.revol/software.html")))