0013-Round-xsl-number-values-to-nearest-integer.patch 814 B

1234567891011121314151617181920212223242526
  1. From 345e0bfb1c1131155a32dfbdfc8f78d1c602dc40 Mon Sep 17 00:00:00 2001
  2. From: Nick Wellnhofer <wellnhofer@aevum.de>
  3. Date: Sun, 10 Apr 2016 12:50:02 +0200
  4. Subject: [PATCH] Round xsl:number values to nearest integer
  5. This matches XSLT 2.0 behavior.
  6. ---
  7. libxslt/numbers.c | 2 ++
  8. 1 file changed, 2 insertions(+)
  9. diff --git a/libxslt/numbers.c b/libxslt/numbers.c
  10. index 184ee6f..eb087bc 100644
  11. --- a/libxslt/numbers.c
  12. +++ b/libxslt/numbers.c
  13. @@ -440,6 +440,8 @@ xsltNumberFormatInsertNumbers(xsltNumberDataPtr data,
  14. for (i = 0; i < numbers_max; i++) {
  15. /* Insert number */
  16. number = numbers[(numbers_max - 1) - i];
  17. + /* Round to nearest like XSLT 2.0 */
  18. + number = floor(number + 0.5);
  19. if (i < tokens->nTokens) {
  20. /*
  21. * The "n"th format token will be used to format the "n"th
  22. --
  23. 2.8.1