乘法R无浮点数 [英] multiplication R without float
问题描述
3.4556546e-8
1.3
0.134435
而不是100 * 0.134435它会做
100/1000000
然后乘以
$ 134435
该函数应该作为输出只是给1000000和134435 - 它只是需要因为我需要处理一些非常大的数字在大整数和mutipliying与anythign除了整数doent work
显然你想做任意精确的算术。
library(gmp)
x< - as.bigq(0.134435 )
100 * x
#Big Rational('bigq'):
#[1] 121088283181110525/9007199254740992
is there a way to do the multiplication with a float in a serie sof two multiplications with integers. I would need to write a function which accepts as input values such as
3.4556546e-8
1.3
0.134435
Instead of doing 100*0.134435 it would do 100/1000000 and then multiply with
134435
the function should as output just give 1000000 and 134435 - it is just needed because i need to work with some very large numbers in big integers and mutipliying with anythign except for intgers doent work
Apparently you want to do arbitrary precision arithmetics. You don't need to reinvent the wheel.
library(gmp)
x <- as.bigq(0.134435)
100 * x
#Big Rational ('bigq') :
# [1] 121088283181110525/9007199254740992
这篇关于乘法R无浮点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!