鉴于 Double 的最大值为 1.7976931348623157E+308...
This is incorrect. The format used for Double
is the binary64 or “double precision” format specified in the IEEE 754-2019 standard. In this format, a finite number is represented as ±f•2e, where f, the fraction portion of the representation, is the number represented by a binary numeral with one digit (0 or 1) before the radix point and 52 bits after it and e, the exponent, is an integer in [−1022, 1023]. So the maximum representable finite value is +1.11111111111111111111111111111111111111111111111111112•21023, which equals +(21−2−52)•21023 = 21024−2971, which is exactly 179,769,313,486,231,570,814,527,423,731,704,356,798,070,567,525,844,996,598,917,476,803,157,260,780,028,538,760,589,558,632,766,878,171,540,458,953,514,382,464,234,321,326,889,464,182,768,467,546,703,537,516,986,049,910,576,551,282,076,245,490,090,389,328,944,075,868,508,455,133,942,304,583,236,903,222,948,165,808,559,332,123,348,274,797,826,204,144,723,168,738,177,180,919,299,881,250,404,026,184,124,858,368, so the C# output is correct.
Java 输出省略有效数字并隐藏真实值。这是因为 Java 规范规定对于默认格式“必须至少有一位数字来表示小数部分,除此之外,还有尽可能多的数字,以唯一区分参数值与类型的相邻值double.” https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Double.html#toString(double)