# rounding off problem.....

4 messages
Open this post in threaded view
|

## rounding off problem.....

 dear members....                                  here is a piece of my code: > tail(YLf14,15)  [1] 5.706871e-217 2.563877e-218 2.823295e-218 2.694622e-222 1.777409e-226  [6] 1.134403e-201 5.269464e-215 2.272121e-219 2.794970e-223 1.630978e-187 [11] 1.721529e-213 5.859815e-178 4.842612e-222 1.333685e-193 1.256051e-174 > YLf16 <- YLf14 + 0.001 > tail(YLf16,15)  [1] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 [13] 0.001 0.001 0.001 Is there any way to avoid the rounding off of YLf16 to 0.001, and take exact values? very many thanks for your time and effort...... yours sincerely, AKSHAY M KULKARNI         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: rounding off problem.....

 "Is there any way ..." Two quick answers: 1. using base R functions and data types the answer is 'no' - a double (i.e. numeric) contains about 15 significant digits.     So 5.678e-100 is fine but   0.01 + 5.678e-100 will keep the .0100000000000000  as the significant digits and "drop" the digits 80 or so places further to the right. 2. there are packages that provide for arbitrary precision calculations     see R CRAN package Rmpfr      https://cran.r-project.org/web/packages/Rmpfr/vignettes/Rmpfr-pkg.pdfHTH, Eric On Fri, Mar 8, 2019 at 2:39 PM akshay kulkarni <[hidden email]> wrote: > dear members.... >                                  here is a piece of my code: > > > tail(YLf14,15) >  [1] 5.706871e-217 2.563877e-218 2.823295e-218 2.694622e-222 1.777409e-226 >  [6] 1.134403e-201 5.269464e-215 2.272121e-219 2.794970e-223 1.630978e-187 > [11] 1.721529e-213 5.859815e-178 4.842612e-222 1.333685e-193 1.256051e-174 > > YLf16 <- YLf14 + 0.001 > > tail(YLf16,15) >  [1] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 > 0.001 > [13] 0.001 0.001 0.001 > > Is there any way to avoid the rounding off of YLf16 to 0.001, and take > exact values? > > very many thanks for your time and effort...... > yours sincerely, > AKSHAY M KULKARNI > > >         [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list -- To UNSUBSCRIBE and more, see > 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. >         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.