Re: [xsl] round-half-to-even problem.

Subject: Re: [xsl] round-half-to-even problem.
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 24 Jan 2011 15:26:10 +0000
On 24/01/2011 14:39, Szabo, Patrick (LNG-VIE) wrote:
round-half-to-even(text(), 2)
That doesn't look like a good idea to me. The content of the text node will be converted to a double under the standard function calling rules, and this may involve a loss of precision because not all decimal numbers can be represented exactly as doubles. The semantics of round-half-to-even then require the double to be converted to a decimal, which might not be the number you first thought of.

Instead, try

round-half-to-even(xs:decimal(.), 2)

Michael Kay
Saxonica

Current Thread