xsl-list
[Top] [All Lists]

Re: [xsl] format-number/bankers' rounding problem

2011-07-13 13:15:59
On 13/07/2011 17:59, daniel whitney wrote:
I saw round-half-to-even but I actually want to round up for positive
and down for negative values. Of course I should have put that at the
very beginning of my post.

hmm wikipedia agrees with me that "bankers rounding" is half-even but whatever, so I think you want

if($n gt 0) then round($n) else (- round(-$n))

assuming you just mean 0.5 goes up or down. If you want all fractional parts to round up if positive and down if negative replace both round() with ceiling() in the above.


David


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>