I'm attempting to take the current system time,
long now = System.currentTimeMillis();
find out how far light has traveled since 1970 (in km),
double km = (now / 1000.0) * 299792.458;
and print the value.
System.out.printf("Since the unix Epoch, light has traveled...\n%f km", km);
But when I run the code, I'm only getting the answer down to two decimals.
435963358497001.750000 km
Is there a reason for this? Printing the value using
System.out.println(km);
gives me
4.3596335849700175E14
Seeing the E there makes sense why it cuts off. Is there a way I could get the value to 3 or more decimal places?