[xsd-users] losing double precision in output xml

Boris Kolpackov boris at codesynthesis.com
Wed Dec 6 02:37:30 EST 2006


Hi David,

David J Stockdill <dstockdi at csc.com> writes:

> I have just started using xsd & it has been great so far.  I am having one
> problem however with type xsd:double losing precision.  I have a double
> type that has a value like 38.3333333338 and the generated XML is 38.3.
> This sounds like the same issue as one I found in the archives:
>
> [xsd-users] losing double precision in output xml (msvc++7.1) (March 15,
> 2006)
>
> The solution was a bug fix in version 2.0.0-2.  I am running
> xsd-2.3.1.b1-i686-windows.  Would that fix be included in this version?  Am
> I missing an XSD option?

Hm, that's odd. I've just tried xsd-2.3.1.b2-i686-windows (which has the
same parsing/serialization code as 2.3.1.b1) on a small test and the above
value gets serialized fully. I tested it with both VC++ 7.1 and 8.0.

Can you try the following test case for me:

#include <iostream>
#include <sstream>

using namespace std;

int
main ()
{
  istringstream is ("38.3333333338");

  double d;
  is >> d;

  cerr.precision (13);
  cerr << d << endl;
}


Also which C++ compiler are you using? If the above test passes, would
it be possible for you to create a small test case that reproduces the
problem?


thanks,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061206/067424d1/attachment.pgp


More information about the xsd-users mailing list