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 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages multiprecision)
20 #:use-module (guix licenses)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages m4)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu))
26
27 (define-public gmp
28 (package
29 (name "gmp")
30 (version "5.1.1")
31 (source (origin
32 (method url-fetch)
33 (uri
34 (string-append "mirror://gnu/gmp/gmp-"
35 version ".tar.xz"))
36 (sha256
37 (base32
38 "1hili06lcf0clg5qfvz7knm6pmj6ab54yhsvskp1mdny5xw4vmjb"))))
39 (build-system gnu-build-system)
40 (native-inputs `(("m4" ,m4)))
41 (arguments `(#:configure-flags
42 '(;; Build a "fat binary", with routines for several
43 ;; sub-architectures.
44 "--enable-fat"
45 "--enable-cxx")))
46 (synopsis "Multiple-precision arithmetic library")
47 (description
48 "GMP is a free library for arbitrary precision arithmetic, operating on
49 signed integers, rational numbers, and floating point numbers. There is no
50 practical limit to the precision except the ones implied by the available
51 memory in the machine GMP runs on. GMP has a rich set of functions, and the
52 functions have a regular interface.
53
54 The main target applications for GMP are cryptography applications and
55 research, Internet security applications, algebra systems, computational
56 algebra research, etc.
57
58 GMP is carefully designed to be as fast as possible, both for small operands
59 and for huge operands. The speed is achieved by using fullwords as the basic
60 arithmetic type, by using fast algorithms, with highly optimised assembly
61 code for the most common inner loops for a lot of CPUs, and by a general
62 emphasis on speed.
63
64 GMP is faster than any other bignum library. The advantage for GMP increases
65 with the operand sizes for many operations, since GMP uses asymptotically
66 faster algorithms.")
67 (license lgpl3+)
68 (home-page "http://gmplib.org/")))
69
70 (define-public mpfr
71 (package
72 (name "mpfr")
73 (version "3.1.2")
74 (source (origin
75 (method url-fetch)
76 (uri (string-append "mirror://gnu/mpfr/mpfr-" version
77 ".tar.xz"))
78 (sha256 (base32
79 "0fs501qi8l523gs3cpy4jjcnvwxggyfbklcys80wq236xx3hz79r"))))
80 (build-system gnu-build-system)
81 (propagated-inputs `(("gmp" ,gmp))) ; <mpfr.h> refers to <gmp.h>
82 (synopsis "C library for arbitrary precision floating-point arithmetic")
83 (description
84 "The GNU MPFR library is a C library for multiple-precision
85 floating-point computations with correct rounding. MPFR is based on the GMP
86 multiple-precision library.
87
88 The main goal of MPFR is to provide a library for multiple-precision
89 floating-point computation which is both efficient and has a well-defined
90 semantics. It copies the good ideas from the ANSI/IEEE-754 standard for
91 double-precision floating-point arithmetic (53-bit mantissa).")
92 (license lgpl3+)
93 (home-page "http://www.mpfr.org/")))
94
95 (define-public mpc
96 (package
97 (name "mpc")
98 (version "1.0.1")
99 (source (origin
100 (method url-fetch)
101 (uri (string-append
102 "mirror://gnu/mpc/mpc-" version ".tar.gz"))
103 (sha256 (base32
104 "1zq0fidp1jii2j5k5n9hmx55a6wwid33gjzhimvxq9d5zrf82npd"))))
105 (build-system gnu-build-system)
106 (propagated-inputs `(("gmp" ,gmp) ; <mpc.h> refers to both
107 ("mpfr" ,mpfr)))
108 (synopsis "C library for arbitrary precision complex arithmetic")
109 (description
110 "GNU MPC is a C library for the arithmetic of complex numbers with
111 arbitrarily high precision and correct rounding of the result. It extends
112 the principles of the IEEE-754 standard for fixed precision real floating
113 point numbers to complex numbers, providing well-defined semantics for
114 every operation. At the same time, speed of operation at high precision
115 is a major design goal. The library is built upon and follows the same
116 principles as GNU MPFR.")
117 (license lgpl3+)
118 (home-page "http://mpc.multiprecision.org/")))