<GSTAmount>26.789999999999999999999999999967899</GSTAmount>
In schema GSTAmount is defined as xsd:decimal and the rounding is done before marshaling by JAXB. I did some serach using Google and learned some tips when dealing with financial amount in Java.
- Use BigDecimal rather than double when defining the financial amount.
- When using BigDecimal use its string conductor.
Here is the excellent link which explains this issue very clearly. How to Use Java BigDecimal: A Tutorial
This comparison between BigNumber and Double is really informative! For developers working with containerized applications, Ninza Host can help you manage and test environments locally, ensuring smooth handling of numeric precision and performance across different data types.
ReplyDelete