[Mpfi-commits] r303 - in trunk/mpfi: . doc src

ptheveny at users.gforge.inria.fr ptheveny at users.gforge.inria.fr
Jeu 17 Juin 14:54:17 CEST 2010


Author: ptheveny
Date: 2010-06-17 14:54:16 +0200 (Thu, 17 Jun 2010)
New Revision: 303

Added:
   trunk/mpfi/src/urandom.c
Modified:
   trunk/mpfi/NEWS
   trunk/mpfi/doc/mpfi.info
   trunk/mpfi/doc/mpfi.texi
   trunk/mpfi/src/Makefile.am
   trunk/mpfi/src/alea.c
   trunk/mpfi/src/mpfi.h
Log:
Add a new function mpfi_urandom so that MPFI does no more use the deprecated mpfr_random.

Modified: trunk/mpfi/NEWS
===================================================================
--- trunk/mpfi/NEWS	2010-06-17 11:53:09 UTC (rev 302)
+++ trunk/mpfi/NEWS	2010-06-17 12:54:16 UTC (rev 303)
@@ -41,7 +41,7 @@
 
 * new functions : Catalan's constant, cubic root, reciprocal square root,
   secant, cosecant, cotangent and hyperbolic counterparts, atan2, hypot,
-  get_version
+  get_version, urandom
 * can now be compiled outside the source directory
 * each function is in its own file (compile_time *= 8;)
 * remove limitation to 1000 characters in mpfi_set_str.

Modified: trunk/mpfi/doc/mpfi.info
===================================================================
--- trunk/mpfi/doc/mpfi.info	2010-06-17 11:53:09 UTC (rev 302)
+++ trunk/mpfi/doc/mpfi.info	2010-06-17 12:54:16 UTC (rev 303)
@@ -1,5 +1,4 @@
-This is /home/ptheveny/svn/mpfi-trunk/mpfi/doc/mpfi.info, produced by
-makeinfo version 4.13 from
+This is mpfi.info, produced by makeinfo version 4.13 from
 /home/ptheveny/svn/mpfi-trunk/mpfi/doc/mpfi.texi.
 
 INFO-DIR-SECTION Software libraries
@@ -8,15 +7,17 @@
 END-INFO-DIR-ENTRY
 
    This file documents MPFI, a library for interval arithmetic, which
-is part of the MPFR multiple precision floating-point arithmetic library
+is part of the MPFR multiple precision floating-point arithmetic
+library
 
    Copyright (C) 2002-2009, Spaces team, INRIA Lorraine and LORIA,
-France, Arenaire team, INRIA Rhone-Alpes and LIP, ENS Lyon, France, and
-Lab. ANO, University of Sciences and Technologies of Lille, France.
+France, Arenaire team, INRIA Rhone-Alpes and LIP, ENS Lyon, France,
+and Lab. ANO, University of Sciences and Technologies of Lille,
+France.
 
-   Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
+   Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
 
    Permission is granted to copy and distribute modified versions of
 this manual under the conditions for verbatim copying, provided that
@@ -39,13 +40,12 @@
 
 * Menu:
 
-* Copying::                     GMP Copying Conditions (LGPL).
-* Introduction to MPFI::        Brief introduction to MPFI.
-* Installing MPFI::             How to configure and compile the MPFI library.
-* Reporting Bugs::              How to usefully report bugs.
-* MPFI Basics::                 What every MPFI user should know.
-* Interval Functions::          Functions for arithmetic on intervals.
-
+* Copying::
+* Introduction to MPFI::
+* Installing MPFI::
+* Reporting Bugs::
+* MPFI Basics::
+* Interval Functions::
 * Contributors::
 * References::
 * Concept Index::
@@ -82,31 +82,32 @@
 This library is "free"; this means that everyone is free to use it and
 free to redistribute it on a free basis.  The library is not in the
 public domain; it is copyrighted and there are restrictions on its
-distribution, but these restrictions are designed to permit everything
-that a good cooperating citizen would want to do.  What is not allowed
-is to try to prevent others from further sharing any version of this
-library that they might get from you.
+distribution, but these restrictions are designed to permit
+everything that a good cooperating citizen would want to do.  What is
+not allowed is to try to prevent others from further sharing any
+version of this library that they might get from you.
 
    Specifically, we want to make sure that you have the right to give
 away copies of the library, that you receive source code or else can
 get it if you want it, that you can change this library or use pieces
 of it in new free programs, and that you know you can do these things.
 
-   To make sure that everyone has such rights, we have to forbid you to
-deprive anyone else of these rights.  For example, if you distribute
-copies of the MPFR/MPFI library, you must give the recipients all the
-rights that you have.  You must make sure that they, too, receive or
-can get the source code.  And you must tell them their rights.
+   To make sure that everyone has such rights, we have to forbid you
+to deprive anyone else of these rights.  For example, if you
+distribute copies of the MPFR/MPFI library, you must give the
+recipients all the rights that you have.  You must make sure that
+they, too, receive or can get the source code.  And you must tell
+them their rights.
 
    Also, for our own protection, we must make certain that everyone
 finds out that there is no warranty for the MPFR/MPFI library.  If it
-is modified by someone else and passed on, we want their recipients to
-know that what they have is not what we distributed, so that any
+is modified by someone else and passed on, we want their recipients
+to know that what they have is not what we distributed, so that any
 problems introduced by others will not reflect on our reputation.
 
-   The precise conditions of the license for the MPFR/MPFI library are
-found in the Lesser General Public License that accompany the source
-code.  See the file COPYING.LIB in the main MPFR directory.
+   The precise conditions of the license for the MPFR/MPFI library
+are found in the Lesser General Public License that accompany the
+source code.  See the file COPYING.LIB in the main MPFR directory.
 
 
 File: mpfi.info,  Node: Introduction to MPFI,  Next: Installing MPFI,  Prev: Copying,  Up: Top
@@ -116,8 +117,8 @@
 
 MPFI is intended to be a portable library written in C for arbitrary
 precision interval arithmetic with intervals represented using MPFR
-reliable floating-point numbers. It is based on the GNU MP library and
-on the MPFR library and is part of the latter.  The purpose of an
+reliable floating-point numbers. It is based on the GNU MP library
+and on the MPFR library and is part of the latter.  The purpose of an
 arbitrary precision interval arithmetic is on the one hand to get
 "guaranteed" results, thanks to interval computation, and on the other
 hand to obtain accurate results, thanks to multiple precision
@@ -137,8 +138,8 @@
 2 Installing MPFI
 *****************
 
-To build MPFI, you first have to install MPFR (version 2.0 or above) on
-your computer.  You need a C compiler, preferably GCC, but any
+To build MPFI, you first have to install MPFR (version 2.0 or above)
+on your computer.  You need a C compiler, preferably GCC, but any
 reasonable compiler should work.  And you need a standard Unix `make'
 program, plus some other standard Unix utility programs.
 
@@ -147,13 +148,13 @@
 
   1. Edit the file `Makefile' and set the various variables: set `CC'
      to your C compiler, `COPT' to the optimization options for the
-     compiler, `C_EXTRA_FLAGS' to some other useful options (`-static'
-     may reveal useful) and `AR', `LD' to the proper  utilities.  Also
-     set `GMP_INCLUDE' to the directory containing the GNU MP header
-     files and `GMP_LIB' to the GNU MP library directory. Similarly,
-     set `MPFR_INCLUDE' to the directory containing the MPFR header
-     files and `MPFR_LIB'  to the directory containing the MPFR library
-     files.
+     compiler, `C_EXTRA_FLAGS' to some other useful options
+     (`-static' may reveal useful) and `AR', `LD' to the proper
+     utilities.  Also set `GMP_INCLUDE' to the directory containing
+     the GNU MP header files and `GMP_LIB' to the GNU MP library
+     directory. Similarly, set `MPFR_INCLUDE' to the directory
+     containing the MPFR header files and `MPFR_LIB'  to the directory
+     containing the MPFR library files.
 
   2. `make all'
 
@@ -210,8 +211,8 @@
 you, and it is not to ask too much from you, to ask you to report the
 bugs that you find.
 
-   There are a few things you should think about when you put your bug
-report together.
+   There are a few things you should think about when you put your
+bug report together.
 
    You have to send us a test case that makes it possible for us to
 reproduce the bug.  Include instructions on how to run the test case.
@@ -223,17 +224,18 @@
 This can be extracted using `cc -V' on some machines or, if you're
 using gcc, `gcc -v'.  Also, include the output from `uname -a'.
 
-   If your bug report is good, we will do our best to help you to get a
-corrected version of the library; if the bug report is poor, we won't
-do anything about it (except kidding you for sending poor bug reports).
+   If your bug report is good, we will do our best to help you to get
+a corrected version of the library; if the bug report is poor, we
+won't do anything about it (except kidding you for sending poor bug
+reports).
 
    Send your bug report to: `Nathalie.Revol at ens-lyon.fr,
 Fabrice.Rouillier at loria.fr, sylvain.chevillard at ens-lyon.org,
 christoph.lauter at ens-lyon.org, hong.diep.nguyen at ens-lyon.fr'.
 
    If you think something in this manual is unclear, or downright
-incorrect, or if the language needs to be improved, please send a note
-to the same address.
+incorrect, or if the language needs to be improved, please send a
+note to the same address.
 
 
 File: mpfi.info,  Node: MPFI Basics,  Next: Interval Functions,  Prev: Reporting Bugs,  Up: Top
@@ -242,9 +244,10 @@
 *************
 
 All declarations needed to use MPFI are collected in the include file
-`mpfi.h'. The declarations useful for inputs and outputs are to be found
-in `mpfi_io.h'. It is designed to work with both C and C++ compilers.
-You should include these files in any program using the MPFI library:
+`mpfi.h'. The declarations useful for inputs and outputs are to be
+found in `mpfi_io.h'. It is designed to work with both C and C++
+compilers.  You should include these files in any program using the
+MPFI library:
 
      #include "mpfi.h"
      #include "mpfi_io.h"
@@ -252,34 +255,35 @@
 4.1 Nomenclature and Types
 ==========================
 
-An "interval" is a connected set of real numbers, it is represented in
-MPFI by its endpoints which are MPFR floating-point numbers.  The C
-data type for these objects is `mpfi_t'. An interval can have finite or
-infinite endpoints and its meaning is straightforward.  It can also
-have one (or both) NaN endpoint(s): this indicates that an invalid
-operation has been performed and that the resulting interval has no
-mathematical meaning. An empty interval has its left endpoint larger
-than its right endpoint. The handling of empty intervals is not
-performed by MPFI and relies on the user.  Some functions on intervals
-return a floating-point value: among such functions are `mpfi_get_left'
-that returns the left endpoint of an interval and `mpfi_diam_abs' that
-gets the width of the input interval.
+An "interval" is a connected set of real numbers, it is represented
+in MPFI by its endpoints which are MPFR floating-point numbers.  The
+C data type for these objects is `mpfi_t'. An interval can have
+finite or infinite endpoints and its meaning is straightforward.  It
+can also have one (or both) NaN endpoint(s): this indicates that an
+invalid operation has been performed and that the resulting interval
+has no mathematical meaning. An empty interval has its left endpoint
+larger than its right endpoint. The handling of empty intervals is
+not performed by MPFI and relies on the user.  Some functions on
+intervals return a floating-point value: among such functions are
+`mpfi_get_left' that returns the left endpoint of an interval and
+`mpfi_diam_abs' that gets the width of the input interval.
 
 A "Floating point number" or "Float" for short, is an arbitrary
-precision mantissa with a limited precision exponent.  The C data type
-for such objects is `mpfr_t'.
+precision mantissa with a limited precision exponent.  The C data
+type for such objects is `mpfr_t'.
 
-The "Precision" is the number of bits used to represent the mantissa of
-a floating-point number; the corresponding C data type is `mp_prec_t'.
+The "Precision" is the number of bits used to represent the mantissa
+of a floating-point number; the corresponding C data type is
+`mp_prec_t'.
 
 4.2 Function Classes
 ====================
 
 There is only one class of functions in the MPFI library:
 
-  1. Functions for interval arithmetic based on floating-point numbers,
-     with names beginning with `mpfi_'.  The associated type is
-     `mpfi_t'.  There are around 150 functions in this class.
+  1. Functions for interval arithmetic based on floating-point
+     numbers, with names beginning with `mpfi_'.  The associated type
+     is `mpfi_t'.  There are around 150 functions in this class.
 
 4.3 MPFI Variable Conventions
 =============================
@@ -289,29 +293,29 @@
 assignment operator.
 
    MPFI allows you to use the same variable for both input and output
-in the same expression.  For example, the function for the exponential,
-`mpfi_exp', can be used like this: `mpfi_exp (x, x)'.  This computes
-the set of exponentials of every real belonging to X and puts the
-result back in X.
+in the same expression.  For example, the function for the
+exponential, `mpfi_exp', can be used like this: `mpfi_exp (x, x)'.
+This computes the set of exponentials of every real belonging to X
+and puts the result back in X.
 
-   Before you can assign an MPFI variable, you need to initialize it by
-calling one of the special initialization functions.  When you're done
-with a variable, you need to clear it out, using one of the appropriate
-functions.
+   Before you can assign an MPFI variable, you need to initialize it
+by calling one of the special initialization functions.  When you're
+done with a variable, you need to clear it out, using one of the
+appropriate functions.
 
-   A variable should be initialized once only, or at least cleared out
-between different initializations.  After a variable has been
+   A variable should be initialized once only, or at least cleared
+out between different initializations.  After a variable has been
 initialized, it can be assigned any number of times.
 
-   For efficiency reasons, avoid to initialize and clear out a variable
-in loops.  Instead, initialize it before entering the loop, and clear
-it out after exiting the loop.
+   For efficiency reasons, avoid to initialize and clear out a
+variable in loops.  Instead, initialize it before entering the loop,
+and clear it out after exiting the loop.
 
-   You don't need to be concerned about allocating additional space for
-MPFI variables, since any variable uses a memory space of fixed size.
-Hence unless you change its precision, or clear and reinitialize it, an
-interval variable will have the same allocated space during all its
-lifetime.
+   You don't need to be concerned about allocating additional space
+for MPFI variables, since any variable uses a memory space of fixed
+size.  Hence unless you change its precision, or clear and
+reinitialize it, an interval variable will have the same allocated
+space during all its lifetime.
 
 4.4 Getting the Latest Version of MPFI
 ======================================
@@ -335,10 +339,11 @@
 representation should be invisible to the user, unfortunately it is
 not...  It is assumed that both endpoints have the same precision;
 however when this does not hold, the largest precision is considered.
-The user has to specify the precision of each variable.  A computation
-that assigns a variable will take place with the precision of the
-assigned variable.  For more information on precision (precision of a
-variable, precision of a calculation), see the MPFR documentation.
+The user has to specify the precision of each variable.  A
+computation that assigns a variable will take place with the
+precision of the assigned variable.  For more information on
+precision (precision of a variable, precision of a calculation), see
+the MPFR documentation.
 
 * Menu:
 
@@ -371,8 +376,8 @@
    * `MPFI_FLAGS_LEFT_ENDPOINT_INEXACT': the left endpoint is inexact
      whereas the right endpoint is exact;
 
-   * `MPFI_FLAGS_RIGHT_ENDPOINT_INEXACT': the right endpoint is inexact
-     whereas the left endpoint is exact;
+   * `MPFI_FLAGS_RIGHT_ENDPOINT_INEXACT': the right endpoint is
+     inexact whereas the left endpoint is exact;
 
    * `MPFI_FLAGS_BOTH_ENDPOINTS_INEXACT'
    To test the exactness of one endpoint, the following functions are
@@ -398,38 +403,39 @@
 
    * `MPFI_RNDD': round towards minus infinity
    The four rounding modes provided by MPFR are still available, see
-MPFR documentation to get their names and information on how to modify
-them.
+MPFR documentation to get their names and information on how to
+modify them.
 
    The default computing precision is handled by MPFR, getting or
-setting its value is performed using the following MPFR functions (cf.
-MPFR documentation):
+setting its value is performed using the following MPFR functions
+(cf. MPFR documentation):
 
  -- Macro: void mpfr_set_default_prec (mp_prec_t PREC)
      Sets the default precision to be *exactly* PREC bits.  The
-     precision of a variable means the number of bits used to store the
-     mantissas of its endpoints.  All subsequent calls to `mpfi_init'
-     will use this precision, but previously initialized variables are
-     unaffected.  This default precision is set to 53 bits initially.
-     The precision PREC can be any integer between `MPFR_PREC_MIN' and
-     `MPFR_PREC_MAX'.
+     precision of a variable means the number of bits used to store
+     the mantissas of its endpoints.  All subsequent calls to
+     `mpfi_init' will use this precision, but previously initialized
+     variables are unaffected.  This default precision is set to 53
+     bits initially.  The precision PREC can be any integer between
+     `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.
 
  -- Macro: mp_prec_t mpfr_get_default_prec ()
      Returns the default MPFR/MPFI precision in bits.
 
    The following two functions are useful for changing the precision
 during a calculation.  A typical use would be for adjusting the
-precision gradually in iterative algorithms like Newton-Raphson, making
-the computation precision closely match the actual accurate part of the
-numbers.
+precision gradually in iterative algorithms like Newton-Raphson,
+making the computation precision closely match the actual accurate
+part of the numbers.
 
  -- Function: int mpfi_set_prec (mpfi_t X, mp_prec_t PREC)
-     Resets the precision of X to be *exactly* PREC bits.  The previous
-     value stored in X is lost. It is equivalent to a call to
-     `mpfi_clear(x)' followed by a call to `mpfi_init2(x, prec)', but
-     more efficient as no allocation is done in case the current
-     allocated space for the mantissas of the endpoints of X is enough.
-     It returns a non-zero value iff the memory allocation failed.
+     Resets the precision of X to be *exactly* PREC bits.  The
+     previous value stored in X is lost. It is equivalent to a call
+     to `mpfi_clear(x)' followed by a call to `mpfi_init2(x, prec)',
+     but more efficient as no allocation is done in case the current
+     allocated space for the mantissas of the endpoints of X is
+     enough.  It returns a non-zero value iff the memory allocation
+     failed.
 
      In case you want to keep the previous value stored in X, use
      `mpfi_round_prec' instead.
@@ -441,13 +447,14 @@
      the largest one is returned.
 
  -- Function: int mpfi_round_prec (mpfi_t X, mp_prec_t PREC)
-     Rounds X with precision PREC, which may be different from that of
-     X.  If PREC is greater or equal to the precision of X, then new
-     space is allocated for the endpoints' mantissas, and they are
-     filled with zeroes.  Otherwise, the mantissas are outwards rounded
-     to precision PREC.  In both cases, the precision of X is changed
-     to PREC.  It returns a value indicating whether the possibly
-     rounded endpoints are exact or not, cf. *note Return Values::.



More information about the Mpfi-commits mailing list