[R] How to improve accuracy of output?

Andrew Simmons @kw@|mmo @end|ng |rom gm@||@com
Tue May 24 16:03:32 CEST 2022


I think you have to use print(df$price, digits = 14)

On Tue, May 24, 2022, 10:01 maithili_shiva--- via R-help <
r-help using r-project.org> wrote:

> Dear Forum
> In my code, I am trying to compute Value at risk.
> I have an issue as mentioned below:
> I have defined
>
>
> options(digits = 14)
> But my output is something like
> >  df$price
> [1] 98.7185273         103.10265923  ............
> However, if use Excel, I get values as
> 98.718527356108 103.10265923704
> and so on.
> Is there any way I can improve on R output accuracy.
> Problem is If I use
> options(digits = 20)
> I still get same prices as when I was using options(digits = 14) and on
> the other hand my confidence level value, which should be equal to 0.99,
> gets distorted to 0.989999999999 impacting  Value at Risk value.
> Please guide
> Regards
> Maithreyi
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org 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]]



More information about the R-help mailing list