English 中文(简体)
其他NN价值是什么?
原标题:What are the other NaN values?

documentation for java.lang.Double.NaN 说:

a 经常持有<代码>杜布尔的无标(N)值。 相当于通过<代码>Double.longBits ToDouble(0x7ff8000000000L)退还的价值。

这似乎意味着还有其他一些。 如果是的话,我如何坚持这些要求,能否这样做?

很显然,我想找到<条码>杜布莱的数值<条码>x。 ......

Double.doubleToRawLongBits(x) != Double.doubleToRawLongBits(Double.NaN)

以及

Double.isNaN(x)

两者都是真实的。

最佳回答

页: 1 页: 1

。 <代码>double ToLongBits don t, 它首先将所有<代码>NaNs转换为Na

double n = Double.longBitsToDouble(0x7ff8000000000000L); // default NaN
double n2 = Double.longBitsToDouble(0x7ff8000000000100L); // also a NaN, but M != 0

System.out.printf("%X
", Double.doubleToLongBits(n));
System.out.printf("%X
", Double.doubleToRawLongBits(n));
System.out.printf("%X
", Double.doubleToLongBits(n2));
System.out.printf("%X
", Double.doubleToRawLongBits(n2));

产出:

7FF8000000000000
7FF8000000000000
7FF8000000000000
7FF8000000000100
问题回答

744将“NaN”定义为所有计票编号(1)和“mantissa”中的“0”。

因此,你正在寻找一个单一人数:

S     E            M
x  11111111   xxxxxx....xxx (with M != 0)

Java也这样做:

Double n = Double.longBitsToDouble(0x7ff8000000000000L); // default NaN
Double n2 = Double.longBitsToDouble(0x7ff8000000000100L); // also a NaN, but M != 0

System.out.println(n.isNaN()); // true
System.out.println(n2.isNaN()); // true
System.out.println(n2 != Double.doubleToLongBits(Double.NaN)); // true

总而言之,你可以使用你想要符合上述规则的任何NaN(所有第1项是权宜之计!) 页: 1





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...