mpfrcpp-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MPFRCPP] Comments, and patches


From: Enrique Perez-Terron
Subject: [MPFRCPP] Comments, and patches
Date: Mon, 13 Apr 2009 21:02:31 +0200

Hello, and thanks for this library.

First, I have stumbled upon a compiler error that is reported in an
earlier post, and I have found the reason.

In function to_string(), the calls to abs(mp_exp_t) require the header
<cstdlib>.

I suggest the following patch:

#------8<------cut here ----8<-----
diff -r -u mpfrcpp-1.4.2/src/mpfrcpp/real/to_string.hpp 
mpfrcpp/src/mpfrcpp/real/to_string.hpp
--- mpfrcpp-1.4.2/src/mpfrcpp/real/to_string.hpp        2007-06-10 
21:40:02.000000000 +0200
+++ mpfrcpp/src/mpfrcpp/real/to_string.hpp      2009-04-11 18:06:23.000000000 
+0200
@@ -34,6 +34,7 @@
 #include <sstream>
 #include <string>
 #include <cmath>
+#include <cstdlib>
 
 namespace mpfr {
 
#------8<------cut here ----8<-----

The attached file "mpfrcpp-patches-all" contains this patch, as well as
others. Here I only quote the two one-line changes.

Second, I suggest a minor fix to the text in examples/quitck_start.cpp,
as the current text is factually incorrect, it says it computes e - 1,
rather than e.

#------8<------cut here ----8<-----
diff -r -u mpfrcpp-1.4.2/examples/quick_start.cpp
mpfrcpp/examples/quick_start.cpp
--- mpfrcpp-1.4.2/examples/quick_start.cpp      2007-05-11 03:53:59.000000000 
+0200
+++ mpfrcpp/examples/quick_start.cpp    2009-04-11 18:28:39.000000000 +0200
@@ -36,7 +36,7 @@
 int main () {
     internal::copyleft();
     Library.setPrecision( Precision( 200 ) );
-    cout << "Example of calculating a lower bound on 1 + 1/2! + ... + 1/100! 
with precision "
+    cout << "Example of calculating a lower bound on 1 + 1/1! + 1/2! + ... + 
1/100! with precision "
     << Library.getPrecision().getMpfrPrecT () << endl;
     cout << endl;
 
#------8<------cut here ----8<-----

Third, I suggest a couple of changes to the Makefile. I discuss the
modifications below. One of the changes also involve a documentation
file, installation.xml. The patches are all contained in the attachment
patch-all.

Fourth, I have written a short explanatory text that explains some
details that I hope can make it easier for new users to start using the
library without having to spend a day reading the code. See the attached
file Overview.txt.

I think this library is very easy to get started with, with most names
very easy to guess. What do you think? Caveat: I don't know the library
well enough yet to be completely certain that every statement is true.
You may want to delete a few words before using the submission.

See the attachment "mpfrcpp-overview.txt".

The suggested modifications to the Makefile consist of five changes.

1. Allow the command sequence "make; sudo make install". 
You may think that "sudo make" is just as good and shorter, but for the
security-conscious user, it is far easier to just read the install
section of the Makefile.

2. I have moved the "doc" directory to /usr/local, because I believe
most people really prefer to let the package manager of their Linux
distribution handle all files in /usr/share (in spite of the name
"share"). By having all non-package stuff in /usr/local, it is easier to
isolate and find. (Non-Linux users probably have to tweak the Makefile
anyway). I have made the installation directories dependent on a macro
PREF which defaults to /usr/local. In that way, to create a normal
package, only that definition needs to change. Also, users wanting to
install the Mpfrcc in, say /opt/mpfrcpp, can just do "make install
PREF=/opt/mpfrcpp". This seems to be popular among Solaris users, even
they will then also have to add -I and -L flags to their own makes.

3. I have added an "uninstall" stanza to the  makefile. In order to make
the install and uninstall match exactly, I have changed the install
stanza to name the libmpfr.a file explicitly. Oh, and the install stanza
now copies the Makefile to the docdir directory, so a user can find it
even after he deleted the source tree.

I have prepared a patch of the file doc/.XML/install.xml that documents
the changes to the Makefile. While editing the xml file, I have also
made some changes to the wording and the grammar. Due to the very long
lines in this source, the patch looks like a complete rewrite. It is
not.

4. Back to the Makefile, there is a minor bug in the "check" stanza. The
line that begins with a "cd" command sends its output to a different
file, a file in the new working directory. This is fixed by adding a
pair of parentheses.

5. I moved those definitions that the user most likely needs to change,
toward the top.

I hope you find any of this useful.

Reagrds
Enrique Perez-Terron



Attachment: mpfrcpp-overview.txt
Description: Text document

Attachment: mpfrcpp-patches-all
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]