cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong XSLT format-number conversion (Rounding Problem)

Former Member
0 Kudos

Hi Everybody,

I am currently working on an XSLT map for a client runnig a 6.20 System.

The mapping has the following part:

<xsl:value-of select="format-number(substring(QUANTITY,2) div 1000,'#.00')"/>

The source QUANTITY value is 0000000000009950 (3 decimals)

The result shoudl be 9.95 but instead it is 9.94.

Can anybody explain either what I am doing wrong or coudl this be a bug?

Thank you for your help.

Kind Regards

Soeren Baek

Accepted Solutions (0)

Answers (1)

Answers (1)

prasannakrishna_mynam
Contributor
0 Kudos

Hi Baek,

<xsl:value-of select="format-number(substring(QUANTITY,2) div 1000,'#.00')"/>

               The source QUANTITY value is 0000000000009950 (3 decimals)

                    The result shoudl be 9.95 but instead it is 9.94.

Here the result variation is because of the div operation. You come across this issue while using the float type operands and perform div on operands in ABAP programming.

Regards,

Prasanna

Former Member
0 Kudos

Thank you for the input.

Do you have any suggestion on how I could do it differently?

Thank you for your input.

Best Regards

Soeren