Subject: [xsl] XPath / XSLT 2.1 - Rounding algorithms From: "Rushforth, Peter" <prushfor@xxxxxxxxxxx> Date: Thu, 13 Nov 2008 16:57:17 -0500 |
A couple of years ago, I ran into a need to call extension functions to round numbers in the "traditional" way: to round half up for results of .5 (or more). I found that it was only possible with XSLT to round to the even number. I am aware that rounding to the nearest even number is the theoretically correct thing to do, this was pointed out at the time. However, this is not the default rounding method in most commonly available office software, and lots of other types of software. Being able to reproduce results from existing systems might help in the growth of XPath and XSLT in replacing non-standard languages in the workplace. In any case, for some applications, it could be important to have access to the IEEE standard algorithms without having to resort to (complicated) extension functions / jump through hoops. http://en.wikipedia.org/wiki/IEEE_754#Rounding_algorithms Specifically, round-half-up(decimal_num,num_digits), where 'up' means towards positive or negative infinity, is what I'm looking for. Peter Rushforth Technology Advisor / Conseiller technique GeoConnections / GioConnexions 650-615 Booth St. / rue Booth Ottawa ON K1A 0E9 E-mail / Courriel: Peter.Rushforth @ NRCan.gc.ca Phone / Tilephone: (613) 943-0784 Fax / telecopier: (613) 947-2410
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XMLschema for XMP?, cavecatem@xxxxxxxxxx | Thread | Re: [xsl] XPath / XSLT 2.1 - Roundi, G. Ken Holman |
[xsl] Global namespace prefixes, Nathan Potter | Date | Re: [xsl] Global namespace prefixes, David Carlisle |
Month |