[freetds] patch: corrects the reading of large integer valueswhen represented as double
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Wed May 19 10:04:20 EDT 2004
>
> On Wed, 19 May 2004, "Jose Luu" <jluu at applia.fr> wrote:
> > In my case, 16 digit integers were transmitted this way and I was
> > losing the last digit (became always 0).
> >
> > This is somehow a borderline case since only 90% of the 16 digit
> > integers can be represented using a double float. However,
> it would make
> > the library more robust to allow for such cases.
> > Also note that the Sybase openclient library is converting
> to 16 places.
> >
> > In the patch below I have allowed for float8 conversion to
> 16 places.
>
> Thanks, Jose. I applied your patch. I'm not completely
> convinced it's
> right, but it is (at least) harmless and seems to be compatible with
> Sybase's implementation.
>
> IIRC, double precision is good only for 15 positions. Frediano once
> showed me how to examine the bit pattern, to know how
> precisely a number
> can be so represented. I'd like to be convinced that your
> 16th position
> is significant.
>
Mmm...
>From printf docs:
"precision specifies the maximum number of significant digits printed"
double have 53 bits of precision (52 + 1 implicit), so it's
log 2^53 = 15,95...
So, yes, 16 seems better...
freddy77
More information about the FreeTDS
mailing list