Java Eclipse调试器不';t在条件断点处停止

Java Eclipse调试器不';t在条件断点处停止,java,eclipse,debugging,Java,Eclipse,Debugging,我想调试Eclipse中的Java代码 代码如下: public Double repulsion(Node n1, Node n2) { Double rep = 0.0; rep = Math.pow(K, 2) / distEuc(n1, n2); System.out.println("Répulsion : " + rep); listForcesRep.add(rep); return rep; } private Doubl

我想调试Eclipse中的Java代码

代码如下:

    public Double repulsion(Node n1, Node n2) {
    Double rep = 0.0;
    rep = Math.pow(K, 2) / distEuc(n1, n2);
    System.out.println("Répulsion : " + rep);
    listForcesRep.add(rep);
    return rep;
}

    private Double distEuc(Node n1, Node n2) {
    Double d = 0.0;
    Object[] n1Attributes = n1.getAttribute("xy");
    Double x1 = (Double) n1Attributes[0];
    Double y1 = (Double) n1Attributes[1];
    Object[] n2Attributes = n2.getAttribute("xy");
    Double x2 = (Double) n2Attributes[0];
    Double y2 = (Double) n2Attributes[1];
    d = Math.sqrt((Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)));
    return d;
}
我在第行切换了一个断点:
rep=Math.pow(K,2)/distEuc(n1,n2)
问题是在某个点上,
rep
变量接受一个值
NaN
,我需要一个条件断点来理解原因

我将条件断点设置为:

但是当我运行调试时,它跳过断点,循环继续进行

我做错了什么?我怎样才能修好它


谢谢

这是因为
rep
在该行仍然等于0.0:
Double rep=0.0

您需要在
System.out.println(“Répulsion:+rep”)上放置一个条件断点
,在计算了
rep
值之后,当执行在该行停止时,您可以“下降到帧”以再次执行该方法


您还应该使用
Double.isNaN(rep)
rep.isNaN()
而不是
rep==Double.NaN

我对Java一无所知,所以这只是一个猜测:在某些语言(例如Python)中,
NaN==NaN
总是
False
。您需要检查rep是否是一个数字,或者使用某种方法检查它是否是NaN。@iled yes有一个函数
isNan()
,正如@andrucz在正确答案中提到的那样。现在它工作了!