public static int min(int a, int b) {
return (a <= b) ? a : b;
}
public static long min(long a, long b) {
return (a <= b) ? a : b;
}
public static float min(float a, float b) {
if (a != a) return a; // a is NaN
if ((a == 0.0f) && (b == 0.0f)
&& (Float.floatToIntBits(b) == negativeZeroFloatBits)) {
return b;
}
return (a <= b) ? a : b;
}
public static double min(double a, double b) {
if (a != a) return a; // a is NaN
if ((a == 0.0d) && (b == 0.0d)
&& (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) {
return b;
}
return (a <= b) ? a : b;
}
以上是Math类中的代码,同样是比较,为什么float和double弄的这么麻烦?a!=a是什么判断?
分享到:
相关推荐
在使用intellj IDEA查看源代码时,调试进入到sun.nio.ch.FileChannelImpl 类时,发现需要反编译才能查看源代码,在IDEA中已经导入了jdk8的源码,后排查发现sun的源代码实际上不在jdk源码中,后找到一份sun源码包,...
希望大家看看,其中除了.java .txt .html之外,那个无法显示类型的文件应该怎么才能看到源代码
javabean部分源代码!
sunJVM的源代码
SUN公司为java程序员们给出的JAVA连接数据库方法,其中有代码实例
sunJVM的源代码9
SUN公司官网上的部分源代码 包括语法,继承等等
jdk1.6 源码(包括sun公司实现的代码)
世界上最好的JVM,你可以根据需要,porting到你自己的平台上,有很详细的文档。
FtpClient(sun)上传下载实例代码
sun.misc.BASE64Decoder 其中包括 Android Base64Jar包 以及Java源代码 sun.misc.BASE64Decoder 其中包括 Android Base64Jar包 以及Java源代码 sun.misc.BASE64Decoder 其中包括 Android Base64Jar包 以及...
sunJVM的源代码
sunJVM的源代码8
sunJVM的源代码10
sunJVM的源代码6
sunJVM的源代码4
sunJVM的源代码7
sunJVM的源代码5
源码易语言浏览器源代码sun,nbayy.5d6d.com
Sun公司代码规范[汇编].pdf