gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[jackhill/guix/guix.git] / gnu / packages / multiprecision.scm
CommitLineData
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>
36757e02 5;;; Copyright © 2016, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
3e3364fc 6;;; Copyright © 2016, 2020 Jan (janneke) 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>
1a753385 9;;; Copyright © 2018, 2019 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)
36757e02 32 #:use-module (gnu packages texinfo)
c44899a2 33 #:use-module (guix packages)
87f5d366 34 #:use-module (guix download)
24aaf2f2 35 #:use-module (guix utils)
c44899a2
LC
36 #:use-module (guix build-system gnu))
37
38(define-public gmp
39 (package
40 (name "gmp")
76feb6e7 41 (version "6.2.0")
c44899a2 42 (source (origin
87f5d366 43 (method url-fetch)
704197f4 44 (uri
93a6f552
AE
45 (string-append "mirror://gnu/gmp/gmp-"
46 version ".tar.xz"))
c44899a2
LC
47 (sha256
48 (base32
76feb6e7 49 "09hmg8k63mbfrx1x3yy6y1yzbbq85kw5avbibhcgrg9z3ganr3i5"))
fc1adab1 50 (patches (search-patches "gmp-faulty-test.patch"))))
c44899a2
LC
51 (build-system gnu-build-system)
52 (native-inputs `(("m4" ,m4)))
9bf62d9b 53 (outputs '("out" "debug"))
3e3364fc
JN
54 (arguments
55 `(#:parallel-tests? #f ; mpz/reuse fails otherwise
56 #:configure-flags
57 '(;; Build a "fat binary", with routines for several
58 ;; sub-architectures.
59 "--enable-fat"
60 "--enable-cxx"
61 ,@(cond ((target-mingw?)
62 ;; Static and shared cannot be built in one go:
63 ;; they produce different headers. We need shared.
64 `("--disable-static"
65 "--enable-shared"))
66 (else '())))
67 ;; Remove after core-updates merge.
68 ;; Workaround for gcc-7 transition breakage, -system and cross-build,
69 ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
70 ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
71 ,@(if (target-mingw?)
72 `(#:phases
73 (modify-phases %standard-phases
74 (add-before 'configure 'setenv
75 (lambda _
76 (let ((gcc (assoc-ref %build-inputs "cross-gcc"))
77 (libc (assoc-ref %build-inputs "cross-libc")))
78 (setenv "CROSS_CPLUS_INCLUDE_PATH"
79 (string-append gcc "/include/c++"
80 ":" gcc "/include"
81 ":" libc "/include"))
82 (format #t "environment variable `CROSS_CPLUS_INCLUDE_PATH' set to `~a'\n"
83 (getenv "CROSS_CPLUS_INCLUDE_PATH"))
84 #t)))))
85 '())))
f50d2669 86 (synopsis "Multiple-precision arithmetic library")
c44899a2 87 (description
245fae90
TGR
88 "The @acronym{GMP, the GNU Multiple Precision Arithmetic} library performs
89arbitrary-precision arithmetic on signed integers, rational numbers and floating
90point numbers. The precision is only limited by the available memory.
91The library is highly optimized, with a design focus on execution speed.
92It is aimed at use in, for example, cryptography and computational algebra.")
4a44e743 93 (license lgpl3+)
75213ad2 94 (home-page "https://gmplib.org/")))
c44899a2 95
8309c389
LC
96(define-public gmp-6.0
97 ;; We keep this one around to bootstrap GCC, to work around a compilation
98 ;; issue on ARM. See
99 ;; <https://gmplib.org/list-archives/gmp-bugs/2015-December/003848.html>.
100 (package
101 (inherit gmp)
102 (version "6.0.0a")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "mirror://gnu/gmp/gmp-"
106 version ".tar.xz"))
107 (sha256
108 (base32
109 "0r5pp27cy7ch3dg5v0rsny8bib1zfvrza6027g2mp5f6v8pd6mli"))
fc1adab1
AK
110 (patches (search-patches "gmp-arm-asm-nothumb.patch"
111 "gmp-faulty-test.patch"))))))
8309c389 112
c44899a2
LC
113(define-public mpfr
114 (package
115 (name "mpfr")
e34ae707 116 (version "4.0.2")
c44899a2 117 (source (origin
87f5d366 118 (method url-fetch)
0db342a5 119 (uri (string-append "mirror://gnu/mpfr/mpfr-" version
c44899a2
LC
120 ".tar.xz"))
121 (sha256 (base32
e34ae707 122 "12m3amcavhpqygc499s3fzqlb8f2j2rr7fkqsm10xbjfc04fffqx"))))
c44899a2 123 (build-system gnu-build-system)
9bf62d9b 124 (outputs '("out" "debug"))
a6ef51e3 125 (propagated-inputs `(("gmp" ,gmp))) ; <mpfr.h> refers to <gmp.h>
5b7900d7 126 (synopsis "C library for arbitrary-precision floating-point arithmetic")
c44899a2 127 (description
932b6072 128 "GNU@tie{}@acronym{MPFR, Multiple Precision Floating-Point Reliably} is a C
5b7900d7
TGR
129library for performing multiple-precision, floating-point computations with
130correct rounding.")
4a44e743 131 (license lgpl3+)
617cf5de 132 (home-page "https://www.mpfr.org/")))
c44899a2
LC
133
134(define-public mpc
135 (package
136 (name "mpc")
e48859b2 137 (version "1.1.0")
c44899a2 138 (source (origin
87f5d366 139 (method url-fetch)
c44899a2 140 (uri (string-append
8e1cd713 141 "mirror://gnu/mpc/mpc-" version ".tar.gz"))
945562d4
AE
142 (sha256
143 (base32
e48859b2 144 "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9"))))
c44899a2 145 (build-system gnu-build-system)
9bf62d9b 146 (outputs '("out" "debug"))
a6ef51e3
LC
147 (propagated-inputs `(("gmp" ,gmp) ; <mpc.h> refers to both
148 ("mpfr" ,mpfr)))
246db471 149 (synopsis "C library for arbitrary-precision complex arithmetic")
c44899a2 150 (description
aaf80ba7
TGR
151 "GNU@tie{}@acronym{MPC, Multiple Precision Complex library} is a C library
152for performing arithmetic on complex numbers. It supports arbitrarily high
246db471 153precision and correctly rounds the results.")
4a44e743 154 (license lgpl3+)
cd5b85c3 155 (home-page "http://www.multiprecision.org/mpc/")))
61bb3555
NG
156
157(define-public mpfi
158 (package
159 (name "mpfi")
36757e02 160 (version "1.5.4")
f89cebb1
TGR
161 (source
162 (origin
163 (method url-fetch)
164 (uri (string-append "https://gforge.inria.fr/frs/download.php"
36757e02 165 "/latestfile/181/mpfi-" version ".tgz"))
f89cebb1 166 (sha256
36757e02 167 (base32 "0mismr1ll3wp788dq2n22s5irm0dziy75byyfdwz22kjbmckhf9v"))))
61bb3555 168 (build-system gnu-build-system)
36757e02
NG
169 (arguments
170 `(#:tests? #f ;tests are broken in this release
171 #:configure-flags '("--enable-static=no")))
172 (native-inputs
173 `(("automake" ,automake)
174 ("autoreconf" ,autoconf)
175 ("libtool" ,libtool)
176 ("texinfo" ,texinfo)))
177 (propagated-inputs
178 `(("gmp" ,gmp) ; <mpfi.h> refers to both
179 ("mpfr" ,mpfr)))
968612b7 180 (home-page "https://gforge.inria.fr/projects/mpfi/")
24a87a14
TGR
181 (synopsis "C library for arbitrary-precision interval arithmetic")
182 (description
ded545d5 183 "@acronym{MPFI, Multiple Precision Floating-point Interval} is a portable C
24a87a14 184library for arbitrary-precision interval arithmetic, with intervals represented
ded545d5
TGR
185using MPFR reliable floating-point numbers. It's based on the @acronym{GMP, GNU
186Multiple Precision Arithmetic} and GNU@tie{}@acronym{MPFR, Multiple Precision
187Floating-Point Reliably} libraries.
24a87a14
TGR
188
189The purpose of arbitrary-precision interval arithmetic is to get results that
190are both guaranteed, thanks to interval computation, and accurate, thanks to
191multiple-precision arithmetic.")
36757e02 192 (license lgpl2.1+)))
cbc084e1 193
df131dba
AE
194(define-public irram
195 (package
196 (name "irram")
197 (version "2013_01")
198 (source
199 (origin
200 (method url-fetch)
201 (uri (string-append "http://irram.uni-trier.de/irram-files/iRRAM_"
202 version ".tar.bz2"))
203 (sha256
204 (base32 "1cdmvb4hsa161rfdjqyhd9sb3fcr43p3a6nsj7cb4kn9f94qmjpj"))))
205 (build-system gnu-build-system)
206 (propagated-inputs `(("gmp" ,gmp) ; <mpfi.h> refers to both
207 ("mpfr" ,mpfr)))
208 (arguments
209 `(#:parallel-build? #f))
210 (synopsis "C++ package for real arithmetic based on the Real-RAM concept")
211 (description
212 "@dfn{iRRAM} is a C++ package for error-free real arithmetic based on
213the concept of a Real-RAM. Its capabilities range from ordinary arithmetic
214over trigonometric functions to linear algebra and differential
215equations. A program using iRRAM is coded in ordinary C++, but may use a
216special class that behaves like real numbers without any
217error. Additionally, iRRAM uses the concept of multi-valued functions.")
218 (license lgpl2.0+)
219 (home-page "http://irram.uni-trier.de/")))
220
cbc084e1
EB
221(define-public qd
222 (package
223 (name "qd")
8eb2c565 224 (version "2.3.22")
f52e8347
TGR
225 (source
226 (origin
227 (method url-fetch)
228 (uri (string-append "https://crd-legacy.lbl.gov/~dhbailey/mpdist/qd-"
229 version ".tar.gz"))
230 (sha256
231 (base32 "1lq609rsp6zpg7zda75lyxzzk1fabzp4jn88j7xfk84mdgjgzh9h"))))
cbc084e1
EB
232 (build-system gnu-build-system)
233 (native-inputs
234 `(("gfortran" ,gfortran)))
235 (arguments
236 `(#:configure-flags `("--disable-enable_fma" ;weird :/
237 "--enable-shared"
238 ,,@(if (string-prefix? "aarch64"
239 (or (%current-target-system)
240 (%current-system)))
241 ;; XXX: The qd_test test fails numerical
242 ;; accuracy checks for 'dd_real::exp()' on
243 ;; aarch64 with GCC 5.4 at -O2. Disabling
244 ;; expensive optimizations lets it pass.
245 '("CXXFLAGS=-O3 -fno-expensive-optimizations")
246 '("CXXFLAGS=-O3")))))
f52e8347 247 (home-page "https://www.davidhbailey.com/dhbsoftware/")
cbc084e1
EB
248 (synopsis "Double-double and quad-double library")
249 (description "This package supports both a double-double
250datatype (approx. 32 decimal digits) and a quad-double datatype (approx. 64
251decimal digits). The computational library is written in C++. Both C++ and
252Fortran-90 high-level language interfaces are provided to permit one to
253convert an existing C++ or Fortran-90 program to use the library with only
254minor changes to the source code. In most cases only a few type statements
255and (for Fortran-90 programs) read/write statements need to be changed. PSLQ
256and numerical quadrature programs are included.")
257 (license bsd-3)))
7ed018e8
EB
258
259(define-public tomsfastmath
260 (package
261 (name "tomsfastmath")
d0d207cd 262 (version "0.13.1")
7ed018e8
EB
263 (synopsis "Large integer arithmetic library")
264 (source (origin
265 (method url-fetch)
266 (uri (string-append "https://github.com/libtom/tomsfastmath/"
267 "releases/download/v" version "/"
d0d207cd 268 "tfm-" version ".tar.xz"))
7ed018e8
EB
269 (sha256
270 (base32
d0d207cd 271 "0f0pmiaskh89sp0q933pafxb914shpaj5ad8sb5rzk1wv8d7mja7"))))
7ed018e8
EB
272 (build-system gnu-build-system)
273 (native-inputs
274 `(("libtool" ,libtool)))
275 (arguments
276 `(#:make-flags (list "-f" "makefile.shared"
277 (string-append "LIBPATH=" %output "/lib")
278 (string-append "INCPATH=" %output "/include")
279 "GROUP=root" "USER=root"
280 "CC=gcc")
281 #:phases
282 (modify-phases %standard-phases
d0d207cd 283 (delete 'configure) ; no configuration
7ed018e8
EB
284 (replace 'check
285 (lambda* (#:key make-flags #:allow-other-keys)
20fe9728
RW
286 (apply invoke "make"
287 "stest" "test_standalone"
288 make-flags)
289 (invoke "./stest")
290 (invoke "./test")))
7ed018e8
EB
291 (add-before 'install 'install-nogroup
292 (lambda _
d0d207cd 293 ;; Let permissions inherit from the current process.
7ed018e8
EB
294 (substitute* "makefile.shared"
295 (("-g \\$\\(GROUP\\) -o \\$\\(USER\\)") ""))
296 #t))
297 (add-after 'install 'install-doc
298 (lambda* (#:key outputs #:allow-other-keys)
299 (let ((docdir (string-append (assoc-ref outputs "out")
300 "/share/doc/tomsfastmath")))
301 (install-file "doc/tfm.pdf" docdir)
302 #t)))
303 (add-after 'install 'install-pc
304 (lambda* (#:key outputs #:allow-other-keys)
305 (let* ((out (assoc-ref outputs "out"))
306 (pc-dir (string-append out "/lib/pkgconfig")))
307 (call-with-output-file "tomsfastmath.pc"
308 (lambda (port)
309 (format port "~
310Name: TomsFastMath
311Description: ~a
312Version: ~a
313Libs: -L~a/lib -ltfm~%"
314 ,synopsis ,version out)))
315 (install-file "tomsfastmath.pc" pc-dir)
316 #t))))))
abd402e3 317 (home-page "https://www.libtom.net/TomsFastMath/")
7ed018e8
EB
318 (description "TomsFastMath is a large integer library written in portable
319ISO C. It is a port of LibTomMath with optional support for inline assembler
320multiplies.")
321 (license public-domain)))
1a753385
EF
322
323(define-public libtommath
324 (package
325 (name "libtommath")
0201e34c 326 (version "1.2.0")
1a753385
EF
327 (outputs '("out" "static"))
328 (source
329 (origin
330 (method url-fetch)
331 (uri (string-append "https://github.com/libtom/libtommath/releases/"
332 "download/v" version "/ltm-" version ".tar.xz"))
333 (sha256
334 (base32
0201e34c 335 "1c8q1qy88cjhdjlk3g24mra94h34c1ldvkjz0n2988c0yvn5xixp"))))
1a753385
EF
336 (build-system gnu-build-system)
337 (arguments
338 '(#:phases
339 (modify-phases %standard-phases
340 (delete 'configure) ; no configure
341 (add-after 'unpack 'prepare-build
342 (lambda _
1a753385
EF
343 ;; We want the shared library by default so force it to be the
344 ;; default makefile target.
345 (delete-file "makefile")
346 (symlink "makefile.shared" "makefile")
347 #t))
348 (add-after 'install 'remove-static-library
349 (lambda* (#:key outputs #:allow-other-keys)
350 (delete-file (string-append (assoc-ref outputs "out")
351 "/lib/libtommath.a"))
352 #t))
353 (replace 'check
0201e34c
EF
354 (lambda* (#:key test-target make-flags #:allow-other-keys)
355 (apply invoke "make" test-target make-flags)
1a753385
EF
356 (invoke "sh" "test")))
357 (add-after 'install 'install-static-library
358 (lambda* (#:key outputs #:allow-other-keys)
359 (invoke "make" "-f" "makefile.unix" "install"
360 (string-append "PREFIX=" (assoc-ref outputs "static"))
361 (string-append "CC=" (which "gcc"))))))
0201e34c 362 #:test-target "test"
1a753385
EF
363 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
364 "CC=gcc")))
365 (native-inputs
366 `(("libtool" ,libtool)))
367 (home-page "https://www.libtom.net/LibTomMath/")
368 (synopsis "Portable number theoretic multiple-precision integer library")
369 (description "LibTomMath is a portable number theoretic multiple-precision
370integer library written entirely in C. It's designed to provide an API that is
371simple to work with that provides fairly efficient routines that build out of
372the box without configuration.")
373 (license unlicense)))
cf3f12f6 374
0201e34c 375(define-public libtommath-1.1
cf3f12f6
EF
376 (package
377 (inherit libtommath)
0201e34c
EF
378 (version "1.1.0")
379 (source
380 (origin
381 (method url-fetch)
382 (uri (string-append "https://github.com/libtom/libtommath/releases/"
383 "download/v" version "/ltm-" version ".tar.xz"))
384 (sha256
385 (base32
386 "1bbyagqzfdbg37k1n08nsqzdf44z8zsnjjinqbsyj7rxg246qilh"))
387 (patches (search-patches "libtommath-fix-linkage.patch"))))
388 (arguments
389 (substitute-keyword-arguments (package-arguments libtommath)
390 ((#:phases phases)
391 `(modify-phases ,phases
392 (add-after 'unpack 'patch-coreutils-call
393 (lambda _
394 ;; Don't pull in coreutils.
395 (substitute* "makefile_include.mk"
396 (("arch") "uname -m"))
397 #t))))
398 ((#:test-target _) "test_standalone")))))
399
400(define-public libtommath-1.0
401 (package
402 (inherit libtommath-1.1)
cf3f12f6
EF
403 (version "1.0.1")
404 (outputs '("out"))
405 (source
406 (origin
407 (method url-fetch)
408 (uri (string-append "https://github.com/libtom/libtommath/releases/"
409 "download/v" version "/ltm-" version ".tar.xz"))
410 (sha256
411 (base32
412 "0sbccdwbkfc680id2fi0x067j23biqcjqilwkk7y9339knrjy0s7"))))
413 (arguments
0201e34c 414 (substitute-keyword-arguments (package-arguments libtommath-1.1)
cf3f12f6
EF
415 ((#:phases phases)
416 `(modify-phases ,phases
417 (delete 'install-static-library)))))))