特殊浮点值 Java

特殊浮点值 Java

// Finite +-0.0
System.out.println("Finite with +-0.0:");
System.out.println("Finite / +-0.0: " + 8.0 / 0.0);
System.out.println("Finite / +-0.0: " + 8.0 / -0.0);
System.out.println("Finite * +-0.0: " + 8.0 * 0.0);
System.out.println("Finite * +-0.0: " + 8.0 * -0.0);
System.out.println("Finite % +-0.0: " + 8.0 % 0.0);
System.out.println("Finite % +-0.0: " + 8.0 % -0.0);
System.out.println("Finite + +-0.0: " + 8.0 + 0.0);
System.out.println("Finite + +-0.0: " + 8.0 + -0.0);
System.out.println("Finite - +-0.0: " + (8.0 - 0.0));
System.out.println("Finite - +-0.0: " + (8.0 - -0.0));
System.out.println();

Finite with +-0.0:
Finite / +-0.0: Infinity
Finite / +-0.0: -Infinity
Finite * +-0.0: 0.0
Finite * +-0.0: -0.0
Finite % +-0.0: NaN
Finite % +-0.0: NaN
Finite + +-0.0: 8.00.0
Finite + +-0.0: 8.0-0.0
Finite - +-0.0: 8.0
Finite - +-0.0: 8.0

// Finite +-∞
System.out.println("Finite with +-∞:");
System.out.println(8.0 / (1.0 / 0));
System.out.println(8.0 / (-1.0 / 0));
System.out.println(8.0 * (1.0 / 0));
System.out.println(8.0 * (-1.0 / 0));
System.out.println(8.0 % (1.0 / 0));
System.out.println(8.0 % (-1.0 / 0));
System.out.println(8.0 + (1.0 / 0));
System.out.println(8.0 + (-1.0 / 0));
System.out.println(8.0 - (1.0 / 0));
System.out.println(8.0 - (-1.0 / 0));
System.out.println();

Finite with +-∞:
0.0
-0.0
Infinity
-Infinity
8.0
8.0
Infinity
-Infinity
-Infinity
Infinity

// +-0.0 +-0.0
System.out.println("+-0.0 with +-0.0:");
System.out.println(0.0 / 0.0);
System.out.println(0.0 / -0.0);
System.out.println(0.0 * 0.0);
System.out.println(0.0 * -0.0);
System.out.println(0.0 % 0.0);
System.out.println(0.0 % -0.0);
System.out.println(0.0 + 0.0);
System.out.println(0.0 + -0.0);
System.out.println(0.0 - 0.0);
System.out.println(0.0 - -0.0);
System.out.println();

System.out.println(-0.0 / 0.0);
System.out.println(-0.0 / -0.0);
System.out.println(-0.0 * 0.0);
System.out.println(-0.0 * -0.0);
System.out.println(-0.0 % 0.0);
System.out.println(-0.0 % -0.0);
System.out.println(-0.0 + 0.0);
System.out.println(-0.0 + -0.0);
System.out.println(-0.0 - 0.0);
System.out.println(-0.0 - -0.0);
System.out.println();

+-0.0 with +-0.0:
NaN
NaN
0.0
-0.0
NaN
NaN
0.0
0.0
0.0
0.0

NaN
NaN
-0.0
0.0
NaN
NaN
0.0
-0.0
-0.0
0.0

// +-∞ Finite
System.out.println("+-∞ with Finite:");
System.out.println((1.0 / 0) / 8.0);
System.out.println((-1.0 / 0) / 8.0);
System.out.println((1.0 / 0) * 8.0);
System.out.println((-1.0 / 0) * 8.0);
System.out.println((1.0 / 0) % 8.0);
System.out.println((-1.0 / 0) % 8.0);
System.out.println((1.0 / 0) + 8.0);
System.out.println((-1.0 / 0) + 8.0);
System.out.println((1.0 / 0) - 8.0);
System.out.println((-1.0 / 0) - 8.0);
System.out.println();

+-∞ with Finite:
Infinity
-Infinity
Infinity
-Infinity
NaN
NaN
Infinity
-Infinity
Infinity
-Infinity

// +-∞ +-∞
System.out.println("+-∞ with +-∞:");
System.out.println((1.0 / 0) / (1.0 / 0));
System.out.println((-1.0 / 0) / (-1.0 / 0));
System.out.println((1.0 / 0) * (1.0 / 0));
System.out.println((-1.0 / 0) * (-1.0 / 0));
System.out.println((1.0 / 0) % (1.0 / 0));
System.out.println((-1.0 / 0) % (-1.0 / 0));
System.out.println((1.0 / 0) + (1.0 / 0));
System.out.println((-1.0 / 0) + (-1.0 / 0));
System.out.println((1.0 / 0) - (1.0 / 0));
System.out.println((-1.0 / 0) - (-1.0 / 0));
System.out.println();

System.out.println((1.0 / 0) / (-1.0 / 0));
System.out.println((-1.0 / 0) / (1.0 / 0));
System.out.println((1.0 / 0) * (-1.0 / 0));
System.out.println((-1.0 / 0) * (1.0 / 0));
System.out.println((1.0 / 0) % (-1.0 / 0));
System.out.println((-1.0 / 0) % (1.0 / 0));
System.out.println((1.0 / 0) + (-1.0 / 0));
System.out.println((-1.0 / 0) + (1.0 / 0));
System.out.println((1.0 / 0) - (-1.0 / 0));
System.out.println((-1.0 / 0) - (1.0 / 0));
System.out.println();

+-∞ with +-∞:
NaN
NaN
Infinity
Infinity
NaN
NaN
Infinity
-Infinity
NaN
NaN

NaN
NaN
-Infinity
-Infinity
NaN
NaN
NaN
NaN
Infinity
-Infinity

// +-0 +-∞
System.out.println("+-0 with +-∞:");
System.out.println(0.0 / (1.0 / 0));
System.out.println(0.0 / (-1.0 / 0));
System.out.println(0.0 * (1.0 / 0));
System.out.println(0.0 * (-1.0 / 0));
System.out.println(0.0 % (1.0 / 0));
System.out.println(0.0 % (-1.0 / 0));
System.out.println(0.0 + (1.0 / 0));
System.out.println(0.0 + (-1.0 / 0));
System.out.println(0.0 - (1.0 / 0));
System.out.println(0.0 - (-1.0 / 0));
System.out.println();

System.out.println(-0.0 / (1.0 / 0));
System.out.println(-0.0 / (-1.0 / 0));
System.out.println(-0.0 * (1.0 / 0));
System.out.println(-0.0 * (-1.0 / 0));
System.out.println(-0.0 % (1.0 / 0));
System.out.println(-0.0 % (-1.0 / 0));
System.out.println(-0.0 + (1.0 / 0));
System.out.println(-0.0 + (-1.0 / 0));
System.out.println(-0.0 - (1.0 / 0));
System.out.println(-0.0 - (-1.0 / 0));
System.out.println();

+-0 with +-∞:
0.0
-0.0
NaN
NaN
0.0
0.0
Infinity
-Infinity
-Infinity
Infinity

-0.0
0.0
NaN
NaN
-0.0
-0.0
Infinity
-Infinity
-Infinity
Infinity

上一篇:linux下如何导入导出MySQL数据库


下一篇:xampp中mysql设置密码