[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XPath / XSLT 2.1 - Rounding algorithms
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|