From maechler at stat.math.ethz.ch  Tue Jul 19 11:35:52 2011
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Tue, 19 Jul 2011 11:35:52 +0200
Subject: [Rd] (no subject)
In-Reply-To: <16AC753F-32F8-4060-BD37-F94883AD8CA4@r-project.org>
References: <23FB7F0C9B136E42B87064C97EAD4991809381@staffexchange3.ul.campus>
	<16AC753F-32F8-4060-BD37-F94883AD8CA4@r-project.org>
Message-ID: <20005.20472.901447.584817@stat.math.ethz.ch>

>>>>> Simon Urbanek <simon.urbanek at r-project.org>
>>>>>     on Tue, 28 Jun 2011 11:31:58 -0400 writes:

    > On Jun 28, 2011, at 9:58 AM, Michelle.Carey wrote:

    >> Hi,
    >> 
    >> 
    >> 
    >> I am trying to write code in C for an R package. I need
    >> high precision in the form of the mpfr and gmp packages.

    > gmp is available as R package
    > http://cran.r-project.org/web/packages/gmp/index.html do
    > you really need it at a lower level than that?

and so is MPFR:  Package 'Rmpfr'

(both on CRAN and R-forge)

.. and I am asking the same question as Simon:
Are you sure you need to use your own C code, 
instead of simply using the R packages 'gmp' and 'Rmpfr' and
work with R code?

--
Martin Maechler, ETH Zurich


    >> I have installed mpfr and gmp under the instructions of
    >> the following website
    >> http://pauillac.inria.fr/cdrom_a_graver/prog/pc/mpfr/eng.htm
    >> and I get no errors. I have put the header files (mpfr.h
    >> and gmp.h) in the folder C:\Program
    >> Files\R\R-2.13.0\include;

    > That doesn't sound right - the instructions you quote
    > install in the default location which is presumably
    > /usr/local so you should simply set your flags to use that
    > location.


    >> allowing my c code to identify the header files by
    >> incorporating include<gmp.h> and include<mpfr.h>.
    >> Unfortunately when I try to include any of the functions
    >> listed in the header file I get compile error stating
    >> that these functions are undeclared,

    > That doesn't sound plausible, either - undeclared function
    > don't cause errors (not in C). Undefined functions do and
    > you have to make sure you link the libraries installed
    > above.


    >> even though the source code is in the same directory as
    >> my c code that I am trying to compile.

    > That bears no meaning - as you said you installed the
    > libraries, so you have to use those. Source code of
    > gmp/mpfr has no effect on your code and should not be
    > anywhere near it.

    > Cheers, Simon


    >> Any help on this matter would be greatly appreciated.
    >> 
    >> 
    >> Kind Regards,
    >> 
    >> Michelle Carey



[Rd] (no subject)
Martin Maechler