如何在Java中将两个大整数相除?

问题描述:

我想将两个大整数相除

a = 23546654
b = 24979799

并将结果翻倍.

尝试

double x = ((double) a) / ((double) b)

首先将您的整数转换为双精度,然后进行除法.如果您有BigInteger(标记指示),则可以使用

which first converts your ints to doubles and then does the division. If you have BigIntegers (which your tag indicates) you may use BigInteger.doubleValue() to extract the double value.