Hey There!
I'm working with some huge data values and all roads have pointed me to the package Rmpfr. The package relies on the GMP library to allow the use of arbitrarily large numbers. However, I'm having some issues as the package seems map "large" values to another value based on the precision of the initial value. Here are some simplified examples to demonstrate the issue:
Runs as Expected (returned value = input value)
mpfr(8888588858885888,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 8.888588858885888e+15
mpfr(4949494949494949,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.949494949494949e+15
Not Run as Expected (Chooses value based on 1) digit after 16th and 2) how many digits after 16th)
mpfr(49494949494949490,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.9494949494949488e+16
mpfr(4949494949494949000,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.949494949494948864e+18
mpfr(4949494949494949888,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.949494949494949888e+18
mpfr(4949494949494949444,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.949494949494949888e+18
mpfr(4949494949494949333,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.949494949494948864e+18
mpfr(4949494949494949111,1000)
#> 1 'mpfr' number of precision 1000 bits
#> [1] 4.949494949494948864e+18
I also tested this package's utilities out on some hexidecimals:
hex <- "0xfe5b64749cdd0a9834badcf852e7c99f53eb773ec24365853fb03356101928fb"
mpfr(Rmpfr::asNumeric(hex),10000)
#>115048939941552632549260648248461595656614636984310649728136178763075311108096
instead of the correct value of
#>115048939941552636718549134770578535145361984022186965092538353455649250683131.
Thoughts?