0

I GET SOA STRING USE Double.parseDouble fd.setFdrRate(Double.parseDouble(coreFD.getInterestRate())); message SOA return 3.7 but screen show 3.7000000000000005 save Database return 3.7 help me to check

1 Answers1

-1

double cannot represent the number 3.7 with full precision. You may consider using BigDecimal instead:

new BigDecimal(coreFD.getInterestRate()).toString() // 3.7

P.S. Always use BigDecimal (or similar-purpose class) for storing finance-related numbers.

Andrew Vershinin
  • 1,958
  • 11
  • 16