Skip to content

Commit 8a52d0c

Browse files
committed
Clarify how MONEY trims off trailing thousands separator.
1 parent 5f128d5 commit 8a52d0c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backend/utils/adt/cash.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* this version handles 64 bit numbers and so can hold values up to
1414
* $92,233,720,368,547,758.07.
1515
*
16-
* $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.76 2007/11/24 15:28:02 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.77 2007/11/24 16:18:48 momjian Exp $
1717
*/
1818

1919
#include "postgres.h"
@@ -337,9 +337,13 @@ cash_out(PG_FUNCTION_ARGS)
337337
strncpy((buf + count - strlen(csymbol) + 1), csymbol, strlen(csymbol));
338338
count -= strlen(csymbol) - 1;
339339

340-
/* XXX What does this do? It seems to duplicate the last character. */
340+
/*
341+
* If points == 0 and the number of digits % mon_group == 0,
342+
* the code above adds a trailing ssymbol on the far right,
343+
* so remove it.
344+
*/
341345
if (buf[LAST_DIGIT] == ssymbol)
342-
buf[LAST_DIGIT] = buf[LAST_PAREN];
346+
buf[LAST_DIGIT] = '\0';
343347

344348
/* see if we need to signify negative amount */
345349
if (minus)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy