• <bdo id='UPJcM'></bdo><ul id='UPJcM'></ul>

    <tfoot id='UPJcM'></tfoot>

    <small id='UPJcM'></small><noframes id='UPJcM'>

    <legend id='UPJcM'><style id='UPJcM'><dir id='UPJcM'><q id='UPJcM'></q></dir></style></legend>
  • <i id='UPJcM'><tr id='UPJcM'><dt id='UPJcM'><q id='UPJcM'><span id='UPJcM'><b id='UPJcM'><form id='UPJcM'><ins id='UPJcM'></ins><ul id='UPJcM'></ul><sub id='UPJcM'></sub></form><legend id='UPJcM'></legend><bdo id='UPJcM'><pre id='UPJcM'><center id='UPJcM'></center></pre></bdo></b><th id='UPJcM'></th></span></q></dt></tr></i><div id='UPJcM'><tfoot id='UPJcM'></tfoot><dl id='UPJcM'><fieldset id='UPJcM'></fieldset></dl></div>

        在这种情况下,可以“a != a";返回“真"?

        In which case could quot;a != aquot; return quot;truequot;?(在这种情况下,可以“a != a;返回“真?)
        <i id='gT7rH'><tr id='gT7rH'><dt id='gT7rH'><q id='gT7rH'><span id='gT7rH'><b id='gT7rH'><form id='gT7rH'><ins id='gT7rH'></ins><ul id='gT7rH'></ul><sub id='gT7rH'></sub></form><legend id='gT7rH'></legend><bdo id='gT7rH'><pre id='gT7rH'><center id='gT7rH'></center></pre></bdo></b><th id='gT7rH'></th></span></q></dt></tr></i><div id='gT7rH'><tfoot id='gT7rH'></tfoot><dl id='gT7rH'><fieldset id='gT7rH'></fieldset></dl></div>
        <tfoot id='gT7rH'></tfoot>

        <small id='gT7rH'></small><noframes id='gT7rH'>

              <legend id='gT7rH'><style id='gT7rH'><dir id='gT7rH'><q id='gT7rH'></q></dir></style></legend>
                  <tbody id='gT7rH'></tbody>

                  <bdo id='gT7rH'></bdo><ul id='gT7rH'></ul>
                  本文介绍了在这种情况下,可以“a != a";返回“真"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  java.lang.Math#min(double, double):

                  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;
                  }
                  

                  在什么情况下 a != a 会返回 true?似乎是当 a 为 NaN 时,但我无法想象一个例子.可以提供一份吗?

                  In which case could a != a return true? It seems that it's when a is NaN, but I can't imagine an example. Could you please provide one?

                  推荐答案

                  一个简单的例子是

                  double d = Double.NaN; // or
                  double d = 0.0/0.0; // or
                  double d = Double.POSITIVE_INFINITY + Double.NEGATIVE_INFINITY;
                  if (Double.isNaN(a)) { // tests if a != a
                     // do something
                  

                  BTW Double.compare() 确实认为 NaN 相等

                  BTW Double.compare() does see NaN as equal

                  if (Double.compare(d, d) == 0) // always.
                  

                  对于任何类型和值,多线程都是可能的.例如

                  With multiple threads this is possible for any type and value. e.g.

                  if (a != /* another thread changes 'a' */ a) {
                      // a thread changed a while you were looking at it.
                  

                  这篇关于在这种情况下,可以“a != a";返回“真"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)
                • <small id='7TF2x'></small><noframes id='7TF2x'>

                    <legend id='7TF2x'><style id='7TF2x'><dir id='7TF2x'><q id='7TF2x'></q></dir></style></legend>

                      <tbody id='7TF2x'></tbody>
                          <tfoot id='7TF2x'></tfoot>

                          <i id='7TF2x'><tr id='7TF2x'><dt id='7TF2x'><q id='7TF2x'><span id='7TF2x'><b id='7TF2x'><form id='7TF2x'><ins id='7TF2x'></ins><ul id='7TF2x'></ul><sub id='7TF2x'></sub></form><legend id='7TF2x'></legend><bdo id='7TF2x'><pre id='7TF2x'><center id='7TF2x'></center></pre></bdo></b><th id='7TF2x'></th></span></q></dt></tr></i><div id='7TF2x'><tfoot id='7TF2x'></tfoot><dl id='7TF2x'><fieldset id='7TF2x'></fieldset></dl></div>
                            <bdo id='7TF2x'></bdo><ul id='7TF2x'></ul>