Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-03 Thread RK
Also when I try the following with Rmpfr, it works jut fine.

> exp(sqrt(mpfr(163, 120)) * Const("pi", 120))
1 'mpfr' number of precision  120   bits 
[1] 262537412640768743.25007601

and

> exp(sqrt(mpfr(163, 400)) * Const("pi", 400))
1 'mpfr' number of precision  400   bits 
[1] 
262537412640768743.25007259719818568887935385633733699086270
753741037821064791011860731295118134618606450419548

Which compares very nicely with the following:

In[10]:= N[Exp[Sqrt[163] Pi], 125]

Out[10]= 
2.6253741264076874325007259719818568887935385633733699086270
753741037821064791011860731295118134618606450419308389*10^17


In the multiprecision business, you can never be too certain that you 
are using the right precision throughout your calculations.


Nordlund, Dan (DSHS/RDA  dshs.wa.gov> writes:

> 
> Ravi,
> 
> Take a look at the following link.  
> 
> https://code.google.com/p/r-bc/
> 
> I followed the instructions to get a Windows version of the 'nix 
utility program , bc (a high precision
> calculator), and the source for an R to bc interface.  After 
installing them, I executed
> 
> exp(sqrt(bc(163))*4*atan(bc(1)))
> 
> in R and got this result
> 
> 
"262537412640768743.2500725971981856888793538563373369908627
075374103782106479101186073116295306145602054347"
> 
> I don't know if this is helpful, but ...
> 
> Dan
> 
> Daniel Nordlund, PhD
> Research and Data Analysis Division
> Services & Enterprise Support Administration
> Washington State Department of Social and Health Services
>

__
R-help@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.


[R] Long input lines in R.exe

2018-12-26 Thread RK
Hi,

When I run R.exe (or Rterm.exe) from cmd.exe and enter in a long input
line, e.g.

print("12345678901234567890123456789012345678901234567890123456789012345678901234567890")

the visible portion of the input is truncated to:

print("123456789012345678901234567890123456789012345678901234567890123456789$

In effect, I cannot see the full input line all at once. The visible
portion of the input, including the $ symbol is 77 characters which
must be a terminal width setting. Scrolling to the other end of the
line, allows me to see the hidden portion but this is not ideal.
Changing options(width=132) within R.exe/cmd.exe shows long output
lines, which tells me that terminal width is not a fundamental
limitation.

This behavior does not occur when using RGui.exe, RStudio, etc. where
the visible portion of the input lines is limited by screen width.

Is there any way to make R.exe show long input lines when using
cmd.exe? I prefer to use R.exe when I am working off the Windows
console.

I am using R 3.5.2 on Win10, 64-bit.

Thanks,
RK

__
R-help@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.