I am using a XSLT file to round off certain values in XML. So of these values are to be rounded of at a decimal precision level 18(upto 18th decimal value). I tried doing this with Altova XMLSpy and Visual Studio. In both the cases the values were trimmed off after certain number of digits. Below is my code:
XML
<DateReceived>20160509</DateReceived>
<CurrentCommitment>0</CurrentCommitment>
<InvestedCapital>1510650</InvestedCapital>
<InsideExpenses>1.4556888888888888888495783095462397857346874356023496</InsideExpenses>
<IEMF>2345.76454</IEMF>
XSLT
<xsl:template match="ROW/InsideExpenses">
<InsideExpenses>
<xsl:value-of select="format-number(round(1000000000000000000 * text()) div 1000000000000000000, '#.##################')"/>
</InsideExpenses>
In case of Altova XML spy the value in tag InsideExpenses was 1.4556888888888888 and in case of Visual studio it was 1.45568888888889(1 less decimal space and 9 in the end). It would be great help to know why this is happening and how can I round the number to 18th decimal place.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…