multiplication of very large with small values [closed]

ぃ、小莉子 提交于 2019-12-25 18:44:33

问题


as the result of a large binomial coefficient I summed sorry stored a number as big integer (from the gmp) package

Big Integer ('bigz') :
[1] > chooseZ(1599,999)

Big Integer ('bigz') : [1] 64702725976477841685087011694882593433664461459998756503370133423490886710992479387020713114439119078572270410565905096678530812549132718109065352925330156276352159906752920126061592461003982967533637590930195693832792290806000097619179060714793020167850667221328682056807933391950779186595385360309444776548462757363488307499961774581415255778468273486215727708155489945082243963752226921889401251140938597561863975549109487674702867681182063412410767713200

now I would need to multiply it with

[1] 1.884357e-08

if I convert into big integer I get that the number 1.88 e-8 is just rounded to 0 which means the multiplication is 0. How can I multiply both numbers in R


回答1:


Can't you divide your big number by 1x10^8 (as integer) and then multiply by 18884357?




回答2:


Try use big rational instead:

huge <- as.bigq(yourcoef,d=1)
tiny <- as.bigq(yoursmall,d=1)
mul.bigq(huge,tiny)


来源:https://stackoverflow.com/questions/30921700/multiplication-of-very-large-with-small-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!