Skip to Content.
Sympa Menu

freetds - Re: [freetds] tds_money_to_string conversion oddity

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] tds_money_to_string conversion oddity
  • Date: Sun, 07 Dec 2003 13:01:37 -0000

Il dom, 2003-12-07 alle 07:17, James K. Lowden ha scritto:
> On Sat, 06 Dec 2003 18:04:17 -0600, "Craig A. Berry" <craigberry AT mac.com>
> wrote:
> >
> > I think I placed too much faith in there being a reason for the exact
> > layout of the format string. The attached patch solves the problem by
> > putting the "0." where it belongs (after the percent sign).
> ...
> - sprintf(s, "0.%02f", atof(s));
> + sprintf(s, "%0.02f", atof(s));
>
> By bad, Craig, sorry about that. I applied your patch, except that we
> don't need/want the leading zero, yes?
>
> sprintf(s, "%.02f", atof(s));
>
> should do the trick, I think.
>
> Regards,
>

I rewrite some code yesterday so this code compile only on platform that
do not support a 64bit int (mainly for performance reasons)... Note
however that conversion from money to double can lose precision and
should be avoided...

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page