Re: [R] Using Rmpfr to round with precision in R

2014-11-29 Thread Artur Augusto
Thanks Martin, looks like the update fixed the issue. The round2 function is just to format the output. now I can get the correct result: library(Rmpfr) sprintf("%#.2f", round(mpfr(1.152, 200),2)) round2(1.152, 2) #[1] "1.15" Artur 2014-11-27 7:10 GMT-02:00 Martin Mae

[R] Using Rmpfr to round with precision in R

2014-11-19 Thread Artur Augusto
I'm trying to use the Rmpfr library with the round() function to apply the round half to even rule and achieve correct results, without errors due the finite precision of float point values. Example of problem: round(1.225,2) #[1] 1.23 So far, this is what I've achieved: library(Rmpfr) x <- c(1

Re: [R] Rounding

2013-01-06 Thread Artur Augusto
For more details about floating-point: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html 2013/1/5 peter dalgaard > > On Jan 5, 2013, at 20:30 , Rolf Turner wrote: > > > On 01/06/2013 07:42 AM, David Arnold wrote: > >> Hi, > >> > >> Can someone explain this: > >> > >>> options(digit