How do I preserve precision in my sum
output? I think that what is happening is that the precision is exactly the same, but one option chooses to round.
public class Main {
public static void main(String[] args) {
final long seconds = 1637208584L;
final long micro_of_second = 795307;
final long sum = seconds + micro_of_second;
System.out.println("seconds + micro_of_second: " + seconds + micro_of_second);
System.out.println("sum: " + sum);
System.out.println("equal?: " + (sum == seconds + micro_of_second));
}
}
Output
seconds + micro_of_second: 1637208584795307
sum: 1638003891
equal?: true