Skip to Content.
Sympa Menu

freetds - [freetds] tds_money_to_string conversion oddity

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig A. Berry" <craigberry AT mac.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] tds_money_to_string conversion oddity
  • Date: Sat, 6 Dec 2003 17:40:55 -0600

I'm seeing an odd thing in trying to track down a failure running
src/tds/unittests/convert.c. The top-level symptom is

failed (-3) to convert 60 (money, 8 bytes) : 108 (numeric).

Stepping through in the debugger, I can see that the money argument
to tds_money_to_string is 2061629744. At the very end of the routine
there is the following rounding code, which seems to assume s
contains a string representation of a fractional number:

/* round to two decimal places */
if (s) {
sprintf(s, "0.%02f", atof(s));
}

But before this code in the example where I encounter the problem, s
is "1.0000", so that after this code, the value of s is "0.1.000000".
That's of course what you would expect sprintf to do given those
inputs, but it's not a valid thing to turn around and pass to
string_to_numeric. Any thoughts on how to debug this further?

My environment is, Compaq C V6.5-001 on OpenVMS Alpha V7.3-1,
building the 20031206 snapshot.

--
________________________________________
Craig A. Berry
mailto:craigberry AT mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser




Archive powered by MHonArc 2.6.24.

Top of Page