Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
42e735df | 2 | ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org> |
24aaf2f2 | 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
df131dba | 4 | ;;; Copyright © 2015, 2018 Andreas Enge <andreas@enge.fr> |
61bb3555 | 5 | ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr> |
7f1c32f0 | 6 | ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> |
abd402e3 | 7 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
cbc084e1 | 8 | ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org> |
849c8989 | 9 | ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> |
c44899a2 | 10 | ;;; |
233e7676 | 11 | ;;; This file is part of GNU Guix. |
c44899a2 | 12 | ;;; |
233e7676 | 13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
c44899a2 LC |
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 | ;;; | |
233e7676 | 18 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
c44899a2 LC |
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 | |
233e7676 | 24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
c44899a2 | 25 | |
1ffa7090 | 26 | (define-module (gnu packages multiprecision) |
4a44e743 | 27 | #:use-module (guix licenses) |
59a43334 | 28 | #:use-module (gnu packages) |
7ed018e8 | 29 | #:use-module (gnu packages autotools) |
1ffa7090 | 30 | #:use-module (gnu packages m4) |
cbc084e1 | 31 | #:use-module (gnu packages gcc) |
c44899a2 | 32 | #:use-module (guix packages) |
87f5d366 | 33 | #:use-module (guix download) |
24aaf2f2 | 34 | #:use-module (guix utils) |
c44899a2 LC |
35 | #:use-module (guix build-system gnu)) |
36 | ||
37 | (define-public gmp | |
38 | (package | |
39 | (name "gmp") | |
89ccb1d8 | 40 | (version "6.1.2") |
c44899a2 | 41 | (source (origin |
87f5d366 | 42 | (method url-fetch) |
704197f4 | 43 | (uri |
93a6f552 AE |
44 | (string-append "mirror://gnu/gmp/gmp-" |
45 | version ".tar.xz")) | |
c44899a2 LC |
46 | (sha256 |
47 | (base32 | |
89ccb1d8 | 48 | "04hrwahdxyqdik559604r7wrj9ffklwvipgfxgj4ys4skbl6bdc7")) |
fc1adab1 | 49 | (patches (search-patches "gmp-faulty-test.patch")))) |
c44899a2 LC |
50 | (build-system gnu-build-system) |
51 | (native-inputs `(("m4" ,m4))) | |
9bf62d9b | 52 | (outputs '("out" "debug")) |
4165fda2 AE |
53 | (arguments `(#:parallel-tests? #f ; mpz/reuse fails otherwise |
54 | #:configure-flags | |
c44899a2 LC |
55 | '(;; Build a "fat binary", with routines for several |
56 | ;; sub-architectures. | |
57 | "--enable-fat" | |
7f1c32f0 JN |
58 | "--enable-cxx" |
59 | ,@(cond ((target-mingw?) | |
60 | ;; Static and shared cannot be built in one go: | |
61 | ;; they produce different headers. We need shared. | |
62 | `("--disable-static" | |
63 | "--enable-shared")) | |
64 | (else '()))))) | |
f50d2669 | 65 | (synopsis "Multiple-precision arithmetic library") |
c44899a2 | 66 | (description |
d62ab657 TGR |
67 | "@dfn{GMP} (the GNU Multiple Precision Arithmetic Library) is a library for |
68 | arbitrary-precision arithmetic, operating on signed integers, rational numbers | |
69 | and floating point numbers. The precision is only limited by the available | |
70 | memory. The library is highly optimized, with a design focus on execution | |
71 | speed. It is aimed at use in, for example, cryptography and computational | |
72 | algebra.") | |
4a44e743 | 73 | (license lgpl3+) |
75213ad2 | 74 | (home-page "https://gmplib.org/"))) |
c44899a2 | 75 | |
8309c389 LC |
76 | (define-public gmp-6.0 |
77 | ;; We keep this one around to bootstrap GCC, to work around a compilation | |
78 | ;; issue on ARM. See | |
79 | ;; <https://gmplib.org/list-archives/gmp-bugs/2015-December/003848.html>. | |
80 | (package | |
81 | (inherit gmp) | |
82 | (version "6.0.0a") | |
83 | (source (origin | |
84 | (method url-fetch) | |
85 | (uri (string-append "mirror://gnu/gmp/gmp-" | |
86 | version ".tar.xz")) | |
87 | (sha256 | |
88 | (base32 | |
89 | "0r5pp27cy7ch3dg5v0rsny8bib1zfvrza6027g2mp5f6v8pd6mli")) | |
fc1adab1 AK |
90 | (patches (search-patches "gmp-arm-asm-nothumb.patch" |
91 | "gmp-faulty-test.patch")))))) | |
8309c389 | 92 | |
c44899a2 LC |
93 | (define-public mpfr |
94 | (package | |
95 | (name "mpfr") | |
849c8989 | 96 | (version "4.0.1") |
c44899a2 | 97 | (source (origin |
87f5d366 | 98 | (method url-fetch) |
0db342a5 | 99 | (uri (string-append "mirror://gnu/mpfr/mpfr-" version |
c44899a2 LC |
100 | ".tar.xz")) |
101 | (sha256 (base32 | |
849c8989 | 102 | "0vp1lrc08gcmwdaqck6bpzllkrykvp06vz5gnqpyw0v3h9h4m1v7")))) |
c44899a2 | 103 | (build-system gnu-build-system) |
9bf62d9b | 104 | (outputs '("out" "debug")) |
a6ef51e3 | 105 | (propagated-inputs `(("gmp" ,gmp))) ; <mpfr.h> refers to <gmp.h> |
5b7900d7 | 106 | (synopsis "C library for arbitrary-precision floating-point arithmetic") |
c44899a2 | 107 | (description |
5b7900d7 TGR |
108 | "GNU@tie{}@dfn{MPFR} (Multiple Precision Floating-Point Reliably) is a C |
109 | library for performing multiple-precision, floating-point computations with | |
110 | correct rounding.") | |
4a44e743 | 111 | (license lgpl3+) |
617cf5de | 112 | (home-page "https://www.mpfr.org/"))) |
c44899a2 LC |
113 | |
114 | (define-public mpc | |
115 | (package | |
116 | (name "mpc") | |
e48859b2 | 117 | (version "1.1.0") |
c44899a2 | 118 | (source (origin |
87f5d366 | 119 | (method url-fetch) |
c44899a2 | 120 | (uri (string-append |
8e1cd713 | 121 | "mirror://gnu/mpc/mpc-" version ".tar.gz")) |
945562d4 AE |
122 | (sha256 |
123 | (base32 | |
e48859b2 | 124 | "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9")))) |
c44899a2 | 125 | (build-system gnu-build-system) |
9bf62d9b | 126 | (outputs '("out" "debug")) |
a6ef51e3 LC |
127 | (propagated-inputs `(("gmp" ,gmp) ; <mpc.h> refers to both |
128 | ("mpfr" ,mpfr))) | |
246db471 | 129 | (synopsis "C library for arbitrary-precision complex arithmetic") |
c44899a2 | 130 | (description |
246db471 TGR |
131 | "GNU@tie{}@dfn{MPC} (Multiple Precision Complex library) is a C library for |
132 | performing arithmetic on complex numbers. It supports arbitrarily high | |
133 | precision and correctly rounds the results.") | |
4a44e743 | 134 | (license lgpl3+) |
45fc77e5 | 135 | (home-page "http://multiprecision.org/mpc/"))) |
61bb3555 NG |
136 | |
137 | (define-public mpfi | |
138 | (package | |
139 | (name "mpfi") | |
f89cebb1 TGR |
140 | (version "1.5.3") |
141 | (source | |
142 | (origin | |
143 | (method url-fetch) | |
144 | (uri (string-append "https://gforge.inria.fr/frs/download.php" | |
145 | "/latestfile/181/" name "-" version ".tar.bz2")) | |
146 | (sha256 | |
147 | (base32 "0bqr8yibl7jbrp0bw7xk1lm7nis7rv26jsz6y8ycvih8n9bx90r3")))) | |
61bb3555 NG |
148 | (build-system gnu-build-system) |
149 | (propagated-inputs `(("gmp" ,gmp) ; <mpfi.h> refers to both | |
150 | ("mpfr" ,mpfr))) | |
24a87a14 TGR |
151 | (synopsis "C library for arbitrary-precision interval arithmetic") |
152 | (description | |
153 | "@dfn{MPFI} (Multiple Precision Floating-point Interval) is a portable C | |
154 | library for arbitrary-precision interval arithmetic, with intervals represented | |
155 | using MPFR reliable floating-point numbers. It's based on the @dfn{GMP} (GNU | |
156 | Multiple Precision Arithmetic) and GNU@tie{}@dfn{MPFR} (Multiple Precision | |
157 | Floating-Point Reliably) libraries. | |
158 | ||
159 | The purpose of arbitrary-precision interval arithmetic is to get results that | |
160 | are both guaranteed, thanks to interval computation, and accurate, thanks to | |
161 | multiple-precision arithmetic.") | |
61bb3555 NG |
162 | (license lgpl2.1+) |
163 | (home-page "https://perso.ens-lyon.fr/nathalie.revol/software.html"))) | |
cbc084e1 | 164 | |
df131dba AE |
165 | (define-public irram |
166 | (package | |
167 | (name "irram") | |
168 | (version "2013_01") | |
169 | (source | |
170 | (origin | |
171 | (method url-fetch) | |
172 | (uri (string-append "http://irram.uni-trier.de/irram-files/iRRAM_" | |
173 | version ".tar.bz2")) | |
174 | (sha256 | |
175 | (base32 "1cdmvb4hsa161rfdjqyhd9sb3fcr43p3a6nsj7cb4kn9f94qmjpj")))) | |
176 | (build-system gnu-build-system) | |
177 | (propagated-inputs `(("gmp" ,gmp) ; <mpfi.h> refers to both | |
178 | ("mpfr" ,mpfr))) | |
179 | (arguments | |
180 | `(#:parallel-build? #f)) | |
181 | (synopsis "C++ package for real arithmetic based on the Real-RAM concept") | |
182 | (description | |
183 | "@dfn{iRRAM} is a C++ package for error-free real arithmetic based on | |
184 | the concept of a Real-RAM. Its capabilities range from ordinary arithmetic | |
185 | over trigonometric functions to linear algebra and differential | |
186 | equations. A program using iRRAM is coded in ordinary C++, but may use a | |
187 | special class that behaves like real numbers without any | |
188 | error. Additionally, iRRAM uses the concept of multi-valued functions.") | |
189 | (license lgpl2.0+) | |
190 | (home-page "http://irram.uni-trier.de/"))) | |
191 | ||
cbc084e1 EB |
192 | (define-public qd |
193 | (package | |
194 | (name "qd") | |
195 | (version "2.3.18") | |
196 | (source (origin | |
197 | (method url-fetch) | |
198 | (uri (string-append "http://crd.lbl.gov/~dhbailey/mpdist/qd-" | |
199 | version ".tar.gz")) | |
200 | (sha256 | |
201 | (base32 | |
202 | "0vkihcj9fyv2cycq8515713gbs3yskhmivy8bznvx72i6ddnn2c1")))) | |
203 | (build-system gnu-build-system) | |
204 | (native-inputs | |
205 | `(("gfortran" ,gfortran))) | |
206 | (arguments | |
207 | `(#:configure-flags `("--disable-enable_fma" ;weird :/ | |
208 | "--enable-shared" | |
209 | ,,@(if (string-prefix? "aarch64" | |
210 | (or (%current-target-system) | |
211 | (%current-system))) | |
212 | ;; XXX: The qd_test test fails numerical | |
213 | ;; accuracy checks for 'dd_real::exp()' on | |
214 | ;; aarch64 with GCC 5.4 at -O2. Disabling | |
215 | ;; expensive optimizations lets it pass. | |
216 | '("CXXFLAGS=-O3 -fno-expensive-optimizations") | |
217 | '("CXXFLAGS=-O3"))))) | |
218 | (home-page "http://crd-legacy.lbl.gov/~dhbailey/mpdist/") | |
219 | (synopsis "Double-double and quad-double library") | |
220 | (description "This package supports both a double-double | |
221 | datatype (approx. 32 decimal digits) and a quad-double datatype (approx. 64 | |
222 | decimal digits). The computational library is written in C++. Both C++ and | |
223 | Fortran-90 high-level language interfaces are provided to permit one to | |
224 | convert an existing C++ or Fortran-90 program to use the library with only | |
225 | minor changes to the source code. In most cases only a few type statements | |
226 | and (for Fortran-90 programs) read/write statements need to be changed. PSLQ | |
227 | and numerical quadrature programs are included.") | |
228 | (license bsd-3))) | |
7ed018e8 EB |
229 | |
230 | (define-public tomsfastmath | |
231 | (package | |
232 | (name "tomsfastmath") | |
233 | (version "0.13.0") | |
234 | (synopsis "Large integer arithmetic library") | |
235 | (source (origin | |
236 | (method url-fetch) | |
237 | (uri (string-append "https://github.com/libtom/tomsfastmath/" | |
238 | "releases/download/v" version "/" | |
239 | "tfm-" (version-major+minor version) ".tar.bz2")) | |
240 | (sha256 | |
241 | (base32 | |
242 | "01rlsvp6lskk2a0gfdi24ak5h8vdwi6kqbvbwjnmb92r0zrfdvwd")) | |
243 | (patches (search-patches "tomsfastmath-constness.patch")))) | |
244 | (build-system gnu-build-system) | |
245 | (native-inputs | |
246 | `(("libtool" ,libtool))) | |
247 | (arguments | |
248 | `(#:make-flags (list "-f" "makefile.shared" | |
249 | (string-append "LIBPATH=" %output "/lib") | |
250 | (string-append "INCPATH=" %output "/include") | |
251 | "GROUP=root" "USER=root" | |
252 | "CC=gcc") | |
253 | #:phases | |
254 | (modify-phases %standard-phases | |
255 | (delete 'configure) ;no configuration | |
256 | (replace 'check | |
257 | (lambda* (#:key make-flags #:allow-other-keys) | |
20fe9728 RW |
258 | (apply invoke "make" |
259 | "stest" "test_standalone" | |
260 | make-flags) | |
261 | (invoke "./stest") | |
262 | (invoke "./test"))) | |
7ed018e8 EB |
263 | (add-before 'install 'install-nogroup |
264 | (lambda _ | |
265 | ;; Let permissions inherit from the current process | |
266 | (substitute* "makefile.shared" | |
267 | (("-g \\$\\(GROUP\\) -o \\$\\(USER\\)") "")) | |
268 | #t)) | |
269 | (add-after 'install 'install-doc | |
270 | (lambda* (#:key outputs #:allow-other-keys) | |
271 | (let ((docdir (string-append (assoc-ref outputs "out") | |
272 | "/share/doc/tomsfastmath"))) | |
273 | (install-file "doc/tfm.pdf" docdir) | |
274 | #t))) | |
275 | (add-after 'install 'install-pc | |
276 | (lambda* (#:key outputs #:allow-other-keys) | |
277 | (let* ((out (assoc-ref outputs "out")) | |
278 | (pc-dir (string-append out "/lib/pkgconfig"))) | |
279 | (call-with-output-file "tomsfastmath.pc" | |
280 | (lambda (port) | |
281 | (format port "~ | |
282 | Name: TomsFastMath | |
283 | Description: ~a | |
284 | Version: ~a | |
285 | Libs: -L~a/lib -ltfm~%" | |
286 | ,synopsis ,version out))) | |
287 | (install-file "tomsfastmath.pc" pc-dir) | |
288 | #t)))))) | |
abd402e3 | 289 | (home-page "https://www.libtom.net/TomsFastMath/") |
7ed018e8 EB |
290 | (description "TomsFastMath is a large integer library written in portable |
291 | ISO C. It is a port of LibTomMath with optional support for inline assembler | |
292 | multiplies.") | |
293 | (license public-domain))) |