Double比较大小

double转long再进行比较:

public class DoubleTest {

	public static void main(String[] args){

		Double value = 13.1;

		Double value2 = 13.1;

		if(Double.doubleToLongBits(value)!=Double.doubleToLongBits(value2)){

			System.out.println("value!=value2");

		}else{

			System.out.println("value==value2");

		}

	}

}


你可能感兴趣的:(Double比较大小)