freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Brandon M. Reynolds" <breynolds AT comtime.com>
- To: 'TDS Development Group' <freetds AT franklin.oit.unc.edu>
- Subject: RE: implementation of dbexit()
- Date: Mon, 9 Oct 2000 10:04:31 -0400
The tds_money to string is broken for money values between 0.10 and 0.00.
This function should be a lot better.
char *tds_money_to_string(TDS_MONEY *money, char *s)
{
/* note: byte order might be different on a big-endian machine. please check
*/
long long longword = (long long)money->mnyhigh<<32|(long long)money->mnylow;
if(longword%10000) { /* does this have a decimal portion? */
char *t;
if(longword < 0) {
*s++='-';
longword=-longword;
}
t=s+sprintf(s, "%lld.%04lld", longword/10000,
longword%10000)-1;
while(*t == '0') /* strip trailing 0's */
*t--='\0';
} else
sprintf(s, "%lld", longword/10000);
return s;
}
Brandon M. Reynolds Ph: (330) 644-3059
Systems Engineer Fax: (330) 644-8110
Commercial Timesharing Inc. Email: bmr AT comtime.com
-
implementation of dbexit(),
Brian Bruns, 10/07/2000
- <Possible follow-up(s)>
- Re: implementation of dbexit(), Michael Kimsal, 10/07/2000
- RE: implementation of dbexit(), Brandon M. Reynolds, 10/09/2000
Archive powered by MHonArc 2.6.24.