且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有人知道这是否是Java库错误吗?

更新时间:2022-12-07 20:06:35

跟进.我错了上面的答案"仅部分解决了测试程序中的问题.它在实际程序中不起作用.

我意识到这很复杂,但是我确实找到了一个修正了神秘不一致输出的修复程序,这应该令人信服:

我在使用toBigDecimal( )[针对该错误数据]:
x = new BigDecimal(x.toString());

我怀疑BigDecimal的某些属性已损坏.不是规模.

Followup. I was incorrect. The above 'answer' only partly solved the problem in the test program. It did not work in the real program.

I realize this is quite involved, but I did find a fix that corrected the mysterious inconsistent outputs, and this should prove convincing:

I added the following line before using toBigDecimal() [for that wrong data]:
x = new BigDecimal( x.toString() );

I would suspect that some attribute of the BigDecimal has gotten corrupted. It was not the scale.