git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1385 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas
1998-11-16 07:01:09 +00:00
parent c284b96c68
commit 4967a338ec

View File

@@ -133,6 +133,8 @@ ultostr (unsigned long val, int base)
* returned from the localconv() subroutine
\********************************************************************/
/* The PrtAmtComma() routine prints a comma-separated currency value */
/* THOU_SEP is a comma in U.S. but a period in some parts of Europe */
/* CENT_SEP is a period in U.S. but a comma in some parts of Europe */
#define THOU_SEP ','
@@ -158,7 +160,7 @@ PrtAmtComma (char * buf, double val, int prec)
amt *= 1000.0;
tmp = val;
for (j=i; j>0; j++) tmp *= 0.001;
for (j=i; j>0; j--) tmp *= 0.001;
tmp -= amt;
ival = tmp;
if (i !=ncommas) {
@@ -173,11 +175,12 @@ PrtAmtComma (char * buf, double val, int prec)
/* place decimal point */
buf --; *buf = CENT_SEP; buf++;
/* print two or three decimal places */
if (3 == prec) {
ival = 1000.0 * (val-amt);
ival = 0.5 + 1000.0 * (val-amt);
buf += sprintf (buf, "%03d", ival);
} else {
ival = 100.0 * (val-amt);
ival = 0.5 + 100.0 * (val-amt);
buf += sprintf (buf, "%02d", ival);
}
@@ -193,7 +196,7 @@ xaccPrintAmount (double val, short shrs)
if (0.0 > val) {
buf[0] = '-';
bufp ++;
val = DABS(val);
val = -val;
}
if (shrs & PRTSHR) {
@@ -208,7 +211,7 @@ xaccPrintAmount (double val, short shrs)
} else {
if (shrs & PRTSYM) {
bufp += sprintf( buf, "%s ", CURRENCY_SYMBOL);
bufp += sprintf( bufp, "%s ", CURRENCY_SYMBOL);
}
if (shrs & PRTSEP) {
PrtAmtComma (bufp, val, 2);