I want to divide two large integers,
a = 23546654
b = 24979799
and to get the result in double.
I want to divide two large integers,
a = 23546654
b = 24979799
and to get the result in double.
Try
double x = ((double) a) / ((double) b)
which first converts your ints to doubles and then does the division. If you have BigInteger
s (which your tag indicates) you may use BigInteger.doubleValue()
to extract the double value.
BigInteger class has a divide
method.
BigInteger result = a.divide(b);
This are plain int
rather than BigInteger.
All you need is
double ratio = (double) a / b;