[freetds] patch: corrects the reading of large integer values when represented as double

James K. Lowden jklowden at schemamania.org
Wed May 19 09:17:57 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.  

--jkl



More information about the FreeTDS mailing list