[xsd-users] xs:double truncation

Aaron Bray ARA/SED abray at ara.com
Fri Jun 20 14:35:12 EDT 2008


I have converted over to using the provided examples for double and
decimal parsing and serialization
It seems they are conflicting one another in definitions though.
What would the correct way to remedy this situation?

double-parsing.hxx(37) : error C2953: 'xsd::cxx::tree::traits<double,C>'
: class template has already been defined
1>        
c:\program files\codesynthesis xsd
3.1\include\xsd\cxx\tree\parsing\double.hxx(28) : see declaration of
'xsd::cxx::tree::traits<double,C>'

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Friday, June 20, 2008 1:38 PM
To: Aaron Bray ARA/SED
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] xs:double truncation

Hi Aaron,

Boris Kolpackov <boris at codesynthesis.com> writes:

> You can achieve the same behavior as in 2.x.x by compiling your code
> with XSD_FP_ALL_DIGITS macro defined. 

Actually, this is not exactly true. In 2.x.x we mapped xsd:double to
double and xsd:decimal to long double. Unfortunately, some compilers
don't like the long double type and issue all kinds of warnings.
So in 3.x.x we have changed the mapping: now both xsd:double and
xsd:decimal are mapped to double. One negative consequence of this
change is that because xsd:decimal cannot be in scientific notation
and both xsd:double and xsd:decimal are mapped to double, xsd:double
is always serialized in fixed notation. I think this is the reason
why you get 0. One solution (illustrated in the custom-double example
I mentioned earlier) is to re-map xsd:decimal back to long double and
use scientific notation for xsd:double.

Boris




More information about the xsd-users mailing list