diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-04-29 07:42:30 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-04-29 07:42:30 +0000 |
commit | 4fd422152c76a252b4953bb110a542f30c2746c9 (patch) | |
tree | a4fc6260822b3bfe5e6e7fb8fbbf7b039d69bd80 /FAQ.html | |
parent | 391c8ee92693d7c972cf0624761f4265cded9295 (diff) | |
download | mpfr-4fd422152c76a252b4953bb110a542f30c2746c9.tar.gz |
The FAQ is now distributed with MPFR. Use update-faq to update it
from the MPFR web site.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3499 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'FAQ.html')
-rw-r--r-- | FAQ.html | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/FAQ.html b/FAQ.html new file mode 100644 index 000000000..2e62af7dd --- /dev/null +++ b/FAQ.html @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + +<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<title>Frequently Asked Questions about MPFR</title> +<style type="text/css"> +dt +{ + margin-top: 2ex; + margin-bottom: 1ex; + font-weight: bolder; +} +</style> +</head> + +<body> + +<h1>Frequently Asked Questions about <cite><acronym>MPFR</acronym></cite></h1> + +<p><strong>Important notice: Problems with a particular version of +<cite><acronym>MPFR</acronym></cite> are discussed in the corresponding +bugs page.</strong></p> + +<p>The latest version of this <acronym>FAQ</acronym> is available at +<a href="http://www.mpfr.org/faq.html">http://www.mpfr.org/faq.html</a>.</p> + +<dl> + +<dt>What are the differences between <cite><acronym>MPF</acronym></cite> +from <cite><acronym>GMP</acronym></cite> and +<cite><acronym>MPFR</acronym></cite>?</dt> + +<dd>Unlike <cite><acronym>MPF</acronym></cite>, the precision of a +<cite><acronym>MPFR</acronym></cite> variable is the <em>exact</em> +number of bits used for its mantissa. This implies that +<cite><acronym>MPFR</acronym></cite> results do not depend on the +number of bits (16, 32, 64 or more) of the underlying architecture. +Also, <cite><acronym>MPFR</acronym></cite> provides an additional +rounding mode argument to its functions; furthermore, it is guaranteed +that the result of any operation is the nearest possible +floating-point value from the exact result (considering the input +variables as exact values), taking into account the precision of the +destination variable and the rounding mode.</dd> + +<dt>How to convert my program written using +<cite><acronym>MPF</acronym></cite> to +<cite><acronym>MPFR</acronym></cite>?</dt> + +<dd>You need to add <q><code>r</code></q> to the function names, and to +specify the rounding mode (<code>GMP_RNDN</code> for rounding to nearest, +<code>GMP_RNDZ</code> for rounding towards zero, <code>GMP_RNDU</code> +for rounding towards plus infinity, <code>GMP_RNDD</code> for rounding +towards minus infinity). You can also define macros as follows: +<pre>#define mpf_add(a, b, c) mpfr_add(a, b, c, GMP_RNDN)</pre> +The header file <samp>mpf2mpfr.h</samp> from the +<cite><acronym>MPFR</acronym></cite> distribution automatically +redefines all <cite><acronym>MPF</acronym></cite> functions in this +way, using the default <cite><acronym>MPFR</acronym></cite> rounding +mode. Thus you simply need to add the following line in all your files +using <cite><acronym>MPF</acronym></cite> functions: +<pre>#include <mpf2mpfr.h></pre> +just after the <samp>gmp.h</samp> and <samp>mpfr.h</samp> header files.</dd> + +<dt>When I link my program with <cite><acronym>MPFR</acronym></cite>, +I get undefined reference to <code>__gmpz_XXXX</code>, +<code>__gmpn_XXXX</code>.</dt> + +<dd>Link your program with <cite><acronym>GMP</acronym></cite>. Assuming +that your program is <samp>foo.c</samp>, you should link it using: +<pre> cc link.c -lmpfr -lgmp</pre> +<cite><acronym>MPFR</acronym></cite> library reference (<samp>-lmpfr</samp>) +should be before <cite><acronym>GMP</acronym></cite>'s one +(<samp>-lgmp</samp>). Another solution is, with <acronym>GNU</acronym> +<samp>ld</samp>, to give all the libraries inside a group: +<pre> gcc link.c -Wl,--start-group libgmp.a libmpfr.a -Wl,--end-group</pre> +See <samp>ld</samp> manual for more details.</dd> + +<dt>My program crashes with high precisions.</dt> + +<dd>Your stack size limit may be too small. You can increase it with the +<samp>limit</samp>, <samp>unlimit</samp> or <samp>ulimit</samp> command, +depending on your shell.</dd> + +</dl> + +</body> + +</html> |