Hi folks, recently I was trying evaluation of some complex function having exactly same starting values as well as same algorithm in both R and .Net environment. However at the end point I notice that there are some differences in the reported figures from those two applications (as much as 0.10%). I feel this is basically due to consideration of different significance digits in handling floating point numbers between R and .Net. Therefore I want to fix the number of digits that should be there after "." in each and every calculations in R. For example suppose I am multiplying two numbers : 18.456 and 20.345. Ideally it should come as 375.48732. However I want R to consider only 2 significant digits i.e. 18.46 & 20.35 and reports 375.66 and should consider this trimmed value for subsequent calculations.It would be good if there is any possibility to define such behavior once at the beginning of my R-session. Is there any way to do that? Thanks, [[alternative HTML version deleted]]
You can use round(value, 2) ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey> -----Oorspronkelijk bericht----- > Van: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] Namens Christofer Bogaso > Verzonden: vrijdag 28 mei 2010 12:51 > Aan: R-help at stat.math.ethz.ch > Onderwerp: [R] Handing significance digits > > Hi folks, recently I was trying evaluation of some complex > function having exactly same starting values as well as same > algorithm in both R and .Net environment. However at the end > point I notice that there are some differences in the > reported figures from those two applications (as much as > 0.10%). I feel this is basically due to consideration of > different significance digits in handling floating point > numbers between R and .Net. > Therefore I want to fix the number of digits that should be > there after "." > in each and every calculations in R. For example suppose I am > multiplying two numbers : 18.456 and 20.345. Ideally it > should come as 375.48732. > However I want R to consider only 2 significant digits i.e. > 18.46 & 20.35 and reports 375.66 and should consider this > trimmed value for subsequent calculations.It would be good if > there is any possibility to define such behavior once at the > beginning of my R-session. > > Is there any way to do that? > > Thanks, > > [[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. >Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
Hi Christofer, I don't know what .Net is doing, but for R these globals are dependent on your machine and platform. ?.Machine ?.Platform Don't know if you can actually hack R into believing otherwise. Did you consider the possibility that the underlying algorithms differ between .Net and R? Cheers Joris On Fri, May 28, 2010 at 12:51 PM, Christofer Bogaso < bogaso.christofer@gmail.com> wrote:> Hi folks, recently I was trying evaluation of some complex function having > exactly same starting values as well as same algorithm in both R and .Net > environment. However at the end point I notice that there are some > differences in the reported figures from those two applications (as much as > 0.10%). I feel this is basically due to consideration of different > significance digits in handling floating point numbers between R and .Net. > Therefore I want to fix the number of digits that should be there after "." > in each and every calculations in R. For example suppose I am multiplying > two numbers : 18.456 and 20.345. Ideally it should come as 375.48732. > However I want R to consider only 2 significant digits i.e. 18.46 & 20.35 > and reports 375.66 and should consider this trimmed value for subsequent > calculations.It would be good if there is any possibility to define such > behavior once at the beginning of my R-session. > > Is there any way to do that? > > Thanks, > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >-- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 Joris.Meys@Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[alternative HTML version deleted]]