Java中的Double.MIN_VALUE大于零? [英] Is Double.MIN_VALUE is greater than zero in Java?

查看:647
本文介绍了Java中的Double.MIN_VALUE大于零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码中发现了一个错误,它将 Double(0.0) Double.MIN_VALUE 进行比较。基本上,以下返回false:

I found a bug in my code which boiled down to comparing Double(0.0) with Double.MIN_VALUE. Essentially, the following returns false:

System.out.println(0.0 > Double.MIN_VALUE);

这可能如何?

推荐答案

根据 javadoc对于Double.MIN_VALUE ,MIN_VALUE是:

According to the javadoc for Double.MIN_VALUE, MIN_VALUE is:


持有最小
正值非零值的常量double = / p>

A constant holding the smallest positive nonzero value of type double

所以Double.MIN_VALUE不是负数,它的正值与Double可以达到零(不为零)一样接近。

So Double.MIN_VALUE is not negative, it's the positive value that's as close as a Double can get to zero (without being zero).

这篇关于Java中的Double.MIN_VALUE大于零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆