1. 程式人生 > >Java中的long與double的區別

Java中的long與double的區別

publicclassTest1{publicstaticvoid main(String[] args)throwsException{long long1 =Long.MAX_VALUE -100L;double dbl1 = long1;long long2 = long1+1;double dbl2 = dbl1+1;double dbl3 = dbl2+Math.ulp(dbl2);System.out.printf("%d %d\n%f %f %f", long1, long2, dbl1, dbl2, dbl3);}}