[R] C module causing rounding errors?
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Fri Jul 9 06:40:52 CEST 2010
Insufficient data. Please read the posting guide, particularly the part about reproducible code.
It might have something to do with "double" vs "float".
"Joseph N. Paulson" <josephpaulson at gmail.com> wrote:
>Hi all!
>
>I am currently writing a C-module for a for loop in which I permute columns
>in a matrix (bootstrapping) and I send a couple of variables into C
>initially. All of it is working, except the initial values I send to R are
>rounded/truncated (I believe rounded).
>
>I am using a 32 bit machine to compile, I am using (I believe) 32 bit R....
>
>While debugging I print the values I am sending to C, and then I print the
>same values using Rprintf and the number gets rounded to 10^-6, which is
>actually causing some errors for me. Is there any way to correct/prevent the
>error?
>
>
>sample output from R
>
> [1,] 1.0000000
> [2,] 1.0256242
> [3,] 1.1826277
> [4,] -0.6937246
> [5,] 1.3633604
>
>sample output from C
>1.000000
>1.025624
>1.182628
>0.693725
>1.363360
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list