The situation can be reproduced by a simple line as below:
Scala version 2.11.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_66).
scala> 0.2+0.7
res0: Double = 0.8999999999999999
So what's the reason behind this? And how can I test the answer to be right if an intermediate process produce an imprecise result?
Thanks.