Reputation: 23
This is what I've tried.
long varOne = 902621492492L;
double varTwo = (double) varOne * 0.0001;
System.out.println(varTwo);
Output: 9.02621492492E7. Why isn't it 90262149.2492 and how do I fix it? Thanks!
Upvotes: 1
Views: 221
Reputation: 28737
Output: 9.02621492492E7. and 90262149.2492 represent the same number.
Upvotes: 2
Reputation: 14333
should be able to do
long varOne = 902621492492L;
double varTwo = varOne.doubleValue() * 0.0001;
System.out.println(varTwo);
but from what I can tell 9.02621492492E7
is the answer.
Upvotes: 0