英文:
Why does (x – y <= j – k – 1) evaluate to FALSE?
问题
以下是:
什么正在这里发生?
下面是
int i = 1, j = 2, k = 3;
double x = 5.5, y = 7.7;
x - y <= j - k - 1 FALSE
-i + 5 * j >= k + 1 TRUE
英文:
What is happening here?
Below is the
int i = 1, j = 2, k = 3;
double x = 5.5, y = 7.7;
x - y <= j - k - 1 FALSE
-i + 5 * j >= k + 1 TRUE
答案1
得分: 2
它(显然)不会:
class Test {
public static void main(String[] args) {
int i = 1, j = 2, k = 3;
double x = 5.5, y = 7.7;
System.err.printf("%f <= %d: %s\n", x - y, j - k - 1, x - y <= j - k - 1);
}
}
产生的输出:
```plain
-2.200000 <= -2: true
但请注意,您发布的代码包含无效的Unicode字符,这将导致编译错误。
<details>
<summary>英文:</summary>
It (obviously) doesn’t:
class Test {
public static void main(String[] args) {
int i = 1, j = 2, k = 3;
double x = 5.5, y = 7.7;
System.err.printf("%f <= %d: %s\n", x - y, j - k - 1, x - y <= j - k - 1);
}
}
yields:
```plain
-2.200000 <= -2: true
But note that the code you’ve posted contains invalid Unicode characters that would lead to a compilation error.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论