I am learning Python these days, and this is probably my first post in Python. I am relatively new to R, and have also used R for about a year. I compare both languages while learning Python. I apologize if this question is too simple.
I'm not sure why R is outputting Infpython for something. Take as an example 2^1500.
In R:
nchar(2^1500)
[1] 3
2^1500
[1] Inf
In Python:
len(str(2**1500))
Out[7]: 452
2**1500
Out[8]: 3507466211043403874...
I have two questions:
a) Why R provides Infwhen Python does not.
b) I researched How to work with large numbers in the stream R? . It seems that it Brobdingnagcan help us deal with large numbers. However, even in this case, I cannot calculate nchar. How to calculate the above expression, i.e. 2 ^ 1500 to R
2^Brobdingnag::as.brob(500)
[1] +exp(346.57)
> nchar(2^Brobdingnag::as.brob(500))
Error in nchar(2^Brobdingnag::as.brob(500)) :
no method for coercing this S4 class to a vector