[xsd-users] no reaction on XSD_CXX_TREE_DECIMAL_PRECISION
Boris Kolpackov
boris at codesynthesis.com
Fri Sep 12 04:32:50 EDT 2008
Hi Gennady,
Gennady Khokhorin <gok at aerometric-ak.com> writes:
> input: 65.043000
> output: 65.043000000000006
>
> Macros, fstream have no effect on results:
> #define XSD_CXX_TREE_FLOAT_PRECISION 3
> #define XSD_CXX_TREE_DOUBLE_PRECISION 3
> #define XSD_CXX_TREE_DECIMAL_PRECISION 3
> ofs.precision(3);
>
> [...]
>
> Msvc8.0 + xsd3.1.0
These macros are only available since XSD 3.2.0. There is a beta
available for 3.2.0 and the final release is coming soon (2-3 weeks):
http://www.codesynthesis.com/pipermail/xsd-users/2008-August/001897.html
Also note that you cannot #define these macros in a file. You need
to specify them in the C++ compiler command line:
-DXSD_CXX_TREE_FLOAT_PRECISION=3
If you need to stick to 3.1.0 then the only way to achieve what you
want is to customize parsing and serialization code for the double
type. This is shown in the following example:
http://www.codesynthesis.com/~boris/tmp/custom-double.zip
Boris
More information about the xsd-users
mailing list