[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Saxon Div Issue

Subject: Re: [xsl] Saxon Div Issue
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Jan 2015 15:52:17 -0000

Mailing Lists Mail daktapaal@xxxxxxxxx wrote:
I have a value 9.88 , I use the div to do an operation

Pseudo code:

var num = 9.88
var result = $num div 100

I expect 0.0988 .. I get 0.09880000000000001

I am using Saxon-EE-9.5.1-5.jar

What is happening?

If you use

<xsl:variable name="$num" as="xs:decimal" select="9.88"/>

and then do

$num div 100

the problem should not occur. I suspect you use an xs:double instead, depending on your real code.

Current Thread