mirror of
https://github.com/Gator96100/ProxSpace.git
synced 2025-08-20 21:33:21 -07:00
Updated msys2 to msys2-base-x86_64-20200903
This commit is contained in:
parent
5bc8dbdc75
commit
2307d54cb1
18501 changed files with 1684082 additions and 720361 deletions
|
@ -20,6 +20,7 @@ Sylvain Chevillard Original version of ai.c
|
|||
Charles Karney mpfr_nrandom and mpfr_erandom functions
|
||||
Fredrik Johansson New version of mpfr_const_euler
|
||||
Mickaël Gastineau MPFRbench program
|
||||
Jianyang Pan Formally proven code for mpfr_add1sp1
|
||||
|
||||
The main authors are included in the MPFR mailing-list <mpfr@inria.fr>.
|
||||
This is the preferred way to contact us. For further information, please
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright 1999, 2001-2019 Free Software Foundation, Inc.
|
||||
Copyright 1999, 2001-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
<!--
|
||||
Copyright 2000-2019 Free Software Foundation, Inc.
|
||||
Copyright 2000-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright 2000-2019 Free Software Foundation, Inc.
|
||||
Copyright 2000-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -20,26 +20,47 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
|
|||
|
||||
##############################################################################
|
||||
|
||||
Changes from version 4.0.1 to version 4.0.2:
|
||||
- Corrected minimal GMP version in the INSTALL file and the MPFR manual.
|
||||
- Option -pedantic is now always removed from __GMP_CFLAGS (see INSTALL).
|
||||
- Shared caches: cleanup; really detect lock failures (abort in this case).
|
||||
- Improved MPFR manual. In particular, corrected/completed the
|
||||
mpfr_get_str description in order to follow the historical behavior
|
||||
and GMP's mpf_get_str function.
|
||||
- Bug fixes (see ChangeLog file).
|
||||
|
||||
Changes from version 4.0.0 to version 4.0.1:
|
||||
- Improved MPFR manual.
|
||||
Changes from versions 4.0.* to version 4.1.0:
|
||||
- The "épinards à la crème" release.
|
||||
- Binary compatible with MPFR 4.0.*, though some minor changes in the
|
||||
behavior of the formatted output functions may be visible, regarded
|
||||
as underspecified behavior or bug fixes (see below).
|
||||
- New --enable-formally-proven-code configure option, to use (when available)
|
||||
formally proven code.
|
||||
- Improved __GMP_CC and __GMP_CFLAGS retrieval (in particular for MS Windows).
|
||||
- Fixed a build failure on some platforms when --with-gmp-build is used.
|
||||
- Bug fixes (see ChangeLog file), in particular in mpfr_div_ui, which
|
||||
could yield an incorrectly rounded result to nearest when using
|
||||
different precisions; this bug had been present since the introduction
|
||||
of mpfr_div_ui, and in MPFR 4.0.0, it was affecting mpfr_div too.
|
||||
- Option -pedantic is now always removed from __GMP_CFLAGS (see INSTALL).
|
||||
- Changed __float128 to the type _Float128 specified in ISO/IEC TS 18661.
|
||||
__float128 is used as a fallback if _Float128 is not supported.
|
||||
- New function mpfr_get_str_ndigits about conversion to a string of digits.
|
||||
- New function mpfr_dot for the dot product (incomplete, experimental).
|
||||
- New functions mpfr_get_decimal128 and mpfr_set_decimal128 (available only
|
||||
when MPFR has been built with decimal float support).
|
||||
- New function mpfr_cmpabs_ui.
|
||||
- New function mpfr_total_order_p for the IEEE 754 totalOrder predicate.
|
||||
- The mpfr_out_str function now accepts bases from -2 to -36, in order to
|
||||
follow mpfr_get_str and GMP's mpf_out_str functions (these cases gave an
|
||||
assertion failure, as with other invalid bases).
|
||||
- Shared caches: cleanup; really detect lock failures (abort in this case).
|
||||
- The behavior of the formatted output functions (mpfr_printf, etc.) with
|
||||
an empty precision field has improved: trailing zeros are kept in a way
|
||||
similar to the formatted output functions from C.
|
||||
- Improved mpfr_add and mpfr_sub when all operands have a precision equal to
|
||||
twice the number of bits per word, e.g., 128 bits on a 64-bit platform.
|
||||
- Optimized the tuning parameters for various architectures.
|
||||
- Improved test coverage to 98.6% of code for x86_64.
|
||||
- Bug fixes.
|
||||
- MPFR manual: corrected/completed the mpfr_get_str description in order to
|
||||
follow the historical behavior and GMP's mpf_get_str function.
|
||||
- New: optional "make check-exported-symbols", mainly for the MPFR developers
|
||||
and binary distributions, to check that MPFR does not define symbols with a
|
||||
GMP reserved prefix (experimental).
|
||||
- Mini-gmp support: replaced --enable-mini-gmp configure option by
|
||||
--with-mini-gmp (still experimental, read doc/mini-gmp).
|
||||
- A GCC bug on Sparc (present at least in old GCC 4.5.3 and 5.5.0 versions),
|
||||
which made several tests fail when TLS was enabled, is now avoided in the
|
||||
tests. The MPFR library itself was not affected and normal code using the
|
||||
MPFR library should not be affected either. Users and distributions that
|
||||
disabled TLS just because of the test failures can safely re-enable it.
|
||||
|
||||
Changes from versions 3.1.* to version 4.0.0:
|
||||
- The "dinde aux marrons" release.
|
||||
|
@ -136,7 +157,7 @@ Changes from versions 3.1.* to version 4.0.0:
|
|||
- Bug fixes. In particular: a speed improvement when the --enable-assert
|
||||
or --enable-assert=full configure option is used with GCC; mpfr_get_str
|
||||
now sets the NaN flag on NaN input and the inexact flag when the conversion
|
||||
is inexact. For a full list, see http://www.mpfr.org/mpfr-3.1.6/#fixed
|
||||
is inexact. For a full list, see https://www.mpfr.org/mpfr-3.1.6/#fixed
|
||||
and the same section for any previous 3.1.x version (follow the links
|
||||
in the "Changes..." sections).
|
||||
- Microsoft Windows: Added support for thread-safe DLL (shared library).
|
||||
|
@ -428,4 +449,4 @@ Changes from version 0.4 to version 1.0:
|
|||
which is called mp_rnd_t.
|
||||
|
||||
You'll find other news concerning the GNU MPFR library on the web
|
||||
page <http://www.mpfr.org/>.
|
||||
page <https://www.mpfr.org/>.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright 1999-2019 Free Software Foundation, Inc.
|
||||
Copyright 1999-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -37,20 +37,8 @@ Table of contents:
|
|||
2. Compiler/library detection
|
||||
##############################################################################
|
||||
|
||||
- if we want to distinguish GMP and MPIR, we can check at configure time
|
||||
the following symbols which are only defined in MPIR:
|
||||
|
||||
#define __MPIR_VERSION 0
|
||||
#define __MPIR_VERSION_MINOR 9
|
||||
#define __MPIR_VERSION_PATCHLEVEL 0
|
||||
|
||||
There is also a library symbol mpir_version, which should match VERSION, set
|
||||
by configure, for example 0.9.0.
|
||||
|
||||
- update ICC detection.
|
||||
* Use only __INTEL_COMPILER instead of the obsolete macro __ICC?
|
||||
* Possibly enable some features with ICC. For instance, removing
|
||||
"&& !defined(__ICC)" from src/mpfr.h works with ICC 15.0.0 20140723.
|
||||
|
||||
##############################################################################
|
||||
3. Changes in existing functions
|
||||
|
@ -117,6 +105,8 @@ Table of contents:
|
|||
4. New functions to implement
|
||||
##############################################################################
|
||||
|
||||
- a function to compute the hash of a floating-point number
|
||||
(suggested by Patrick Pelissier)
|
||||
- implement new functions from the C++17 standard:
|
||||
http://en.cppreference.com/w/cpp/numeric/special_math
|
||||
assoc_laguerre, assoc_legendre, comp_ellint_1, comp_ellint_2, comp_ellint_3,
|
||||
|
@ -127,15 +117,6 @@ Table of contents:
|
|||
See also https://isocpp.org/files/papers/P0226R1.pdf and §29.9.5 in the
|
||||
C++17 draft:
|
||||
https://github.com/cplusplus/draft/blob/master/source/numerics.tex
|
||||
- implement mpfr_get_decimal128 and mpfr_set_decimal128
|
||||
- implement mpfr_log_ui to compute log(n) for an unsigned long n.
|
||||
We can write for argument reduction n = 2^k * n/2^k, where
|
||||
2/3 <= n/2^k < 4/3, i.e., k = floor(log2(3n))-1, thus
|
||||
log(n) = k*log(2) + log(n/2^k), and we can use binary splitting on the
|
||||
Taylor expansion of log(1+x) to compute log(n/2^k), where at most
|
||||
p*log(2)/log(3) terms are needed for precision p.
|
||||
Other idea (from Fredrik Johansson): compute log(m) + log(n/m) where
|
||||
m=2^a*3^b*5^c*7^d and m is close to n.
|
||||
- implement mpfr_q_sub, mpfr_z_div, mpfr_q_div?
|
||||
- implement mpfr_pow_q and variants with two integers (native or mpz)
|
||||
instead of a rational? See IEEE P1788.
|
||||
|
@ -294,6 +275,80 @@ Table of contents:
|
|||
- asec, acsc, acot, asech, acsch and acoth (mail from Björn Terelius on mpfr
|
||||
list, 18 June 2009)
|
||||
|
||||
- function to reduce the precision of a variable, with a ternary value in
|
||||
input, i.e. taking care of double rounding. Two possible forms: like
|
||||
mpfr_set (i.e. with input and output) or like mpfr_prec_round (i.e. with
|
||||
a single variable). mpfr_subnormalize and mpfr_round_nearest_away_end
|
||||
could use it.
|
||||
|
||||
- UBF functions for +, -, *, fmma, /, sqrt.
|
||||
Support UBF in mpfr_check_range or add mpfr_ubf_check_range?
|
||||
Make this available in the API, e.g. for MPC.
|
||||
|
||||
- mpfr_cmp_uj and mpfr_cmp_sj. They would be useful to test MPFR with
|
||||
_MPFR_EXP_FORMAT=4.
|
||||
|
||||
- base conversion with the round-trip property using a minimal precision,
|
||||
such as the to_chars functions from the C++ standard:
|
||||
|
||||
The functions [...] ensure that the string representation consists
|
||||
of the smallest number of characters such that there is at least
|
||||
one digit before the radix point (if present) and parsing the
|
||||
representation using the corresponding from_chars function
|
||||
recovers value exactly. [Note: This guarantee applies only if
|
||||
to_chars and from_chars are executed on the same implementation.
|
||||
— end note] If there are several such representations, the
|
||||
representation with the smallest difference from the
|
||||
floating-point argument value is chosen, resolving any remaining
|
||||
ties using rounding according to round_to_nearest.
|
||||
|
||||
Text from: https://www.zsh.org/mla/workers/2019/msg01138.html
|
||||
|
||||
- Serialization / Deserialization. Suggested by Frédéric Pétrot:
|
||||
https://sympa.inria.fr/sympa/arc/mpfr/2020-02/msg00006.html
|
||||
like mpfr_fpif_{import,export}, but with memory instead of file.
|
||||
|
||||
Idea of implementation to reuse most of the code and change very little:
|
||||
|
||||
Instead of passing a FILE *fh, pass a struct ext_data *h, and instead of
|
||||
using fread and fwrite, use
|
||||
h->read (h, buffer, size)
|
||||
h->write (h, buffer, size)
|
||||
respectively.
|
||||
|
||||
The struct ext_data structure could contain the following fields:
|
||||
* read: pointer to a wrapper function for the read method.
|
||||
* write: pointer to a wrapper function for the write method.
|
||||
* FILE *fh: to be used for operations with files.
|
||||
* unsigned char *arena: to be used for operations with memory.
|
||||
|
||||
The wrapper functions for the read method could be:
|
||||
|
||||
static int
|
||||
read_from_file (struct ext_data *h, unsigned char *buffer, size_t size)
|
||||
{
|
||||
return fread (buffer, size, 1, h->fh) != 1;
|
||||
}
|
||||
|
||||
static int
|
||||
read_from_memory (struct ext_data *h, unsigned char *buffer, size_t size)
|
||||
{
|
||||
if (h->arena == NULL)
|
||||
return 1;
|
||||
memcpy (buffer, h->arena, size);
|
||||
h->arena += size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
So I expect very few changes in the existing code:
|
||||
* Write a few wrapper functions.
|
||||
* Rename mpfr_fpif_export to mpfr_fpif_export_aux and
|
||||
mpfr_fpif_import to mpfr_fpif_import_aux.
|
||||
* In the existing functions, replace FILE *fh, and fread/fwrite
|
||||
calls as mentioned above.
|
||||
* Add new mpfr_fpif_export, mpfr_fpif_import, mpfr_fpif_export_mem,
|
||||
mpfr_fpif_import_mem.
|
||||
|
||||
##############################################################################
|
||||
5. Efficiency
|
||||
##############################################################################
|
||||
|
@ -306,9 +361,6 @@ Table of contents:
|
|||
using recursive instead of iterative binary splitting:
|
||||
https://github.com/fredrik-johansson/arb/blob/master/elefun/exp_sum_bs_powtab.c
|
||||
- improve mpfr_grandom using the algorithm in http://arxiv.org/abs/1303.6257
|
||||
- use the src/x86_64/corei5/mparam.h file once GMP recognizes correctly the
|
||||
Core i5 processors (note that gcc -mtune=native gives __tune_corei7__
|
||||
and not __tune_corei5__ on those processors)
|
||||
- implement a mpfr_sqrthigh algorithm based on Mulders' algorithm, with a
|
||||
basecase variant
|
||||
- use mpn_div_q to speed up mpfr_div. However mpn_div_q, which is new in
|
||||
|
@ -450,17 +502,6 @@ Table of contents:
|
|||
option (but this does not affect the C library, which may or may not
|
||||
accept signaling NaNs).
|
||||
|
||||
- check again coverage: on 2007-07-27, Patrick Pelissier reports that the
|
||||
following files are not tested at 100%: add1.c, atan.c, atan2.c,
|
||||
cache.c, cmp2.c, const_catalan.c, const_euler.c, const_log2.c, cos.c,
|
||||
gen_inverse.h, div_ui.c, eint.c, exp3.c, exp_2.c, expm1.c, fma.c, fms.c,
|
||||
lngamma.c, gamma.c, get_d.c, get_f.c, get_ld.c, get_str.c, get_z.c,
|
||||
inp_str.c, jn.c, jyn_asympt.c, lngamma.c, mpfr-gmp.c, mul.c, mul_ui.c,
|
||||
mulders.c, out_str.c, pow.c, print_raw.c, rint.c, root.c, round_near_x.c,
|
||||
round_raw_generic.c, set_d.c, set_ld.c, set_q.c, set_uj.c, set_z.c, sin.c,
|
||||
sin_cos.c, sinh.c, sqr.c, stack_interface.c, sub1.c, sub1sp.c, subnormal.c,
|
||||
uceil_exp2.c, uceil_log2.c, ui_pow_ui.c, urandomb.c, yn.c, zeta.c, zeta_ui.c.
|
||||
|
||||
- check the constants mpfr_set_emin (-16382-63) and mpfr_set_emax (16383) in
|
||||
get_ld.c and the other constants, and provide a testcase for large and
|
||||
small numbers.
|
||||
|
@ -494,24 +535,6 @@ Table of contents:
|
|||
* In debug mode, MPFR would check that the result is exact
|
||||
(i.e. that the ternary value is 0).
|
||||
|
||||
- new "rounding mode" MPFR_RNDF (faithful rounding)?
|
||||
This is not really a rounding mode since it is non-deterministic. The
|
||||
goal is to avoid the Table Maker's Dilemma in internal computations.
|
||||
The definition of faithful rounding of a real number x is: return either
|
||||
RNDD(x) or RNDU(x). This means that if x is exactly representable, one
|
||||
returns x exactly. In MPFR, the ternary value should be unspecified for
|
||||
efficiency reasons.
|
||||
Note: One typically implements faithful rounding by computing an
|
||||
approximation to the result with some adequately chosen error bound,
|
||||
then by rounding this approximation to nearest.
|
||||
Concerning the choice of the error bound, if the result x is equal to
|
||||
1 + t, where t is a very small positive number, then the error bound
|
||||
needs to be at most ulp(x)/4 + t. Since t can be arbitrarily small,
|
||||
the error bound needs to be at most ulp(x)/4. And this error bound
|
||||
is sufficient in all cases. Note that with the even rounding rule or
|
||||
rounding away from zero, it is not needed to relax the condition when
|
||||
x is exactly representable.
|
||||
|
||||
- add tests of the ternary value for constants
|
||||
|
||||
- When doing Extensive Check (--enable-assert=full), since all the
|
||||
|
@ -630,15 +653,6 @@ Table of contents:
|
|||
that is, with a large error during the computation of the secondary term
|
||||
(when the TMD occurs).
|
||||
|
||||
- add internal or public variants of some basic functions (+, -, *) with
|
||||
mpz_t as the exponent for correctly rounded polynomials (like fmma),
|
||||
in order to avoid internal overflow and underflow in extreme cases?
|
||||
Alternatively, for fmma, modify add*.c and sub*.c code to define
|
||||
mpfr_add_raw, which takes arrays of limbs and their precision, and the
|
||||
positive exponent delta (as mpfr_uexp_t to be always representable).
|
||||
The exponent delta should be sufficient for now since it can be bounded
|
||||
by MPFR_PREC_MAX+1 if need be.
|
||||
|
||||
- use the keyword "static" in array indices of parameter declarations with
|
||||
C99 compilers (6.7.5.3p7) when the pointer is expected not to be null?
|
||||
For instance, if mpfr.h is changed to have:
|
||||
|
@ -674,6 +688,12 @@ Table of contents:
|
|||
constants) because we do not have the control of memory allocation for
|
||||
mpz_init.
|
||||
|
||||
- use GCC's nonnull attribute (available since GCC 4.0) where applicable.
|
||||
|
||||
- avoid the use of MPFR_MANT(x) as an lvalue; use other (more high level)
|
||||
internal macros if possible, such as MPFR_TMP_INIT1, MPFR_TMP_INIT and
|
||||
MPFR_ALIAS.
|
||||
|
||||
|
||||
##############################################################################
|
||||
7. Portability
|
||||
|
@ -689,4 +709,17 @@ Table of contents:
|
|||
|
||||
- use https://gcc.gnu.org/viewcvs/gcc/trunk/config/stdint.m4 for mpfr-gmp.h
|
||||
|
||||
- with MinGW, build with -D__USE_MINGW_ANSI_STDIO by default?
|
||||
- By default, GNU Automake adds -I options to local directories, with
|
||||
the side effect that these directories have the precedence to search
|
||||
for system headers (#include <...>). This may make the build fail if
|
||||
a C implementation includes a file that has the same name as one used
|
||||
in such a directory.
|
||||
For instance, if one adds an empty file "src/bits/types.h", then the
|
||||
MPFR build fails under Linux because /usr/include/stdio.h has
|
||||
#include <bits/types.h>
|
||||
Possible workaround:
|
||||
* disable the default -I options with nostdinc as documented in
|
||||
the Automake manual;
|
||||
* have a rule that copies the needed files ("mpfr.h" or they should
|
||||
be prefixed with "mpfr-") to $(top_builddir)/include;
|
||||
* use "-I$(top_builddir)/include".
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Example illustrating how to use mpfr_can_round. */
|
||||
|
||||
/*
|
||||
Copyright 2016-2019 Free Software Foundation, Inc.
|
||||
Copyright 2016-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -60,5 +60,6 @@ main (void)
|
|||
}
|
||||
mpfr_clear (x);
|
||||
mpfr_clear (y);
|
||||
mpfr_free_cache ();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Copyright 2009-2019 Free Software Foundation, Inc.
|
||||
Copyright 2009-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -93,5 +93,6 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
mpfr_clears (VARS, (mpfr_ptr) 0);
|
||||
mpfr_free_cache ();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Copyright 2009-2019 Free Software Foundation, Inc.
|
||||
Copyright 2009-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -87,5 +87,6 @@ int main (int argc, char **argv)
|
|||
mpfr_printf ("z = %.*Rb\n", pprec, z);
|
||||
|
||||
mpfr_clears (LIST, (mpfr_ptr) 0);
|
||||
mpfr_free_cache ();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc.
|
||||
Copyright 1999-2004, 2006-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -52,5 +52,6 @@ int main (void)
|
|||
mpfr_clear (s);
|
||||
mpfr_clear (t);
|
||||
mpfr_clear (u);
|
||||
mpfr_free_cache ();
|
||||
return 0;
|
||||
}
|
||||
|
|
90
msys2/usr/share/doc/mpfr/examples/threads.c
Normal file
90
msys2/usr/share/doc/mpfr/examples/threads.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/* Multithreading test to detect scaling issues with MPFR.
|
||||
|
||||
Define:
|
||||
* the function F;
|
||||
* the precision PREC;
|
||||
* the value V as an expression that will have the type double
|
||||
(it may depend on the thread number i).
|
||||
|
||||
Example:
|
||||
gcc threads.c -lmpfr -lgmp -lpthread -DF=mpfr_sin -DPREC=200 -DV=100
|
||||
|
||||
Copyright 2018-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
||||
The GNU MPFR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The GNU MPFR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
|
||||
https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <mpfr.h>
|
||||
|
||||
#define MAX_THREADS 256
|
||||
|
||||
static int m;
|
||||
|
||||
static void *start_routine (void *arg)
|
||||
{
|
||||
mpfr_t x, y;
|
||||
int i = *(int *) arg, j;
|
||||
|
||||
(void) i; /* avoid a warning if i is not used by V */
|
||||
|
||||
mpfr_inits2 (PREC, x, y, (mpfr_ptr) 0);
|
||||
mpfr_set_d (x, (V), MPFR_RNDN);
|
||||
|
||||
for (j = 0; j < m; j++)
|
||||
F (y, x, MPFR_RNDN);
|
||||
|
||||
mpfr_clears (x, y, (mpfr_ptr) 0);
|
||||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i, n;
|
||||
pthread_t tid[MAX_THREADS];
|
||||
|
||||
if (argc != 3 ||
|
||||
(m = atoi (argv[1]), m < 1) ||
|
||||
(n = atoi (argv[2]), n < 1 || n > MAX_THREADS))
|
||||
{
|
||||
fprintf (stderr, "Usage: %s <#iterations> <#threads>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
printf ("%d iteration(s), %d thread(s).\n", m, n);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
if (pthread_create (&tid[i], NULL, start_routine, &i) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: failed to create thread %d\n", argv[0], i);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
if (pthread_join (tid[i], NULL) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: failed to join thread %d\n", argv[0], i);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010-2019 Free Software Foundation, Inc.
|
||||
Copyright 2010-2020 Free Software Foundation, Inc.
|
||||
Contributed by the AriC and Caramba projects, INRIA.
|
||||
|
||||
This file is part of the GNU MPFR Library.
|
||||
|
@ -239,5 +239,6 @@ int main (void)
|
|||
printf ("sizeof(mpfr_ptr) = %d\n", (int) sizeof(mpfr_ptr));
|
||||
failure_test ();
|
||||
|
||||
mpfr_free_cache ();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue