[2263] XML dump of DOUBLE rounds values

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Mar 26 16:58:03 CDT 2007


Hi All,

Well, after some play I have found not nice things.


-------------
* we have in C/C++ language some DOUBLE value

    double dv = 10149.25;


-------------
* we do standard C call

        printf( buff, "%G", dv );

And we get 
    buff = "10149.2" on MAC, XCODE
    buff = "10149.3" on WIN, MS Visual

-------------
* IF to increase precision
        printf( buff, "%.40G", dv );

 We get something as

    buff = "10149.2500036346345676547567567785678"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected trail.


--------------
RESUME:

    there is no technical way convert any possible DOUBLE VALUE
    into string accurately.


This is why I again want to point. If you need EXACT storage of numbers,
DO NOT use DOUBLE/FLOAT type.




-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list