I am writing mathematical function using Java and when I try to compare my result with ms office excel formula function the accuracy of the both the values missing which make my comparison(==)
fails in case of double values.
My result:
2.3450414545545569404E16
MS excel result:
2.34504145455455694E16
I did some research on it and found few links but it doesn't solve my issue and I can't use the Big decimal as it won't be consistent to my end result.
I couldn't understand why my function shows extra values (404E16) and how it can be formatted to produce output like (2.34504145455455694E16)
use
strictfp
in your method. That may solve accuracy problems.This link provides more information on
strictfp
.