diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-02-12 22:59:17 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2017-03-01 21:04:42 +0100 |
commit | 19d274c68063c2799436bbba3cb11b0de9a1f75b (patch) | |
tree | 73cbb5b2a1ad13f143896d6f363ac8358c942b05 /module/ice-9 | |
parent | 92222727f81b2a03cde124b88d7e6224ecb29199 (diff) |
i18n: Do not represent zero as "-0".
Partly fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.
* module/ice-9/i18n.scm (monetary-amount->locale-string): Don't negate
AMOUNT when it's zero.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["positive inexact
zero, 1 digit"]: New test.
("monetary-amount->locale-string")["positive inexact zero"]: New test.
Diffstat (limited to 'module/ice-9')
-rw-r--r-- | module/ice-9/i18n.scm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/module/ice-9/i18n.scm b/module/ice-9/i18n.scm index 1d12dd061..1326a2a02 100644 --- a/module/ice-9/i18n.scm +++ b/module/ice-9/i18n.scm @@ -1,6 +1,7 @@ ;;;; i18n.scm --- internationalization support -*- coding: utf-8 -*- -;;;; Copyright (C) 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc. +;;;; Copyright (C) 2006, 2007, 2009, 2010, 2012, +;;;; 2017 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -335,7 +336,7 @@ locale is used." (substring dec 0 fraction-digits) dec))))) - (external-repr (number->string (if (> amount 0) amount (- amount)))) + (external-repr (number->string (if (>= amount 0) amount (- amount)))) (int+dec (string-split external-repr #\.)) (int (car int+dec)) (dec (decimal-part (if (null? (cdr int+dec)) @@ -387,7 +388,7 @@ number of fractional digits to be displayed." (substring dec 0 fraction-digits) dec)))))) - (let* ((external-repr (number->string (if (> number 0) + (let* ((external-repr (number->string (if (>= number 0) number (- number)))) (int+dec (string-split external-repr #\.)) |