I have a complex data processing algorithm implemented using Java 8 and using Double as data type.
(我有一个使用Java 8并使用Double作为数据类型实现的复杂数据处理算法。)
Given the same input (many hundred thousand database rows) this algorithm outputs different Double values. (给定相同的输入(数十万个数据库行),此算法将输出不同的Double值。)
Sometimes value a is returned, sometimes value b . (有时值返回,有时值b。)
These two values alternate each execution. (这两个值交替执行。)
The difference between a and b is ~0.0001. (a和b之间的差异为?0.0001。)
I am aware that Double datatype does not grant exact values like Decimal does. (我知道Double数据类型不会像Decimal那样授予确切的值。)
I am not sure, however, if it grants repeatable results, assuming exactly same input. (我不确定,但是,如果输入完全相同,它是否可以提供可重复的结果。)
Ie would it be possible that rounding policies are applied in a non-consistent way? (是否有可能以不一致的方式应用舍入策略?)
My purpose here would be to explain why I get different values with same input. (我的目的是解释为什么我用相同的输入得到不同的值。)
Other details: I am using Tomcat 8 runtime environment, deployment done on SAP HCP.
(其他详细信息:我正在使用Tomcat 8运行时环境,在SAP HCP上完成了部署。)
Datatype at database level is Decimal , we need Double at Java level for historical reasons. (数据库级别的数据类型为Decimal ,出于历史原因,我们需要Java级别的Double。)
ask by MoZZoZoZZo translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…