[xsd-users] comparison operation

Boris Kolpackov boris at codesynthesis.com
Mon Jul 14 16:19:16 EDT 2008


Hi Ray,

Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:

> So, there are two effects going on here. One is that the serialization to
> XML loses digits after microseconds. The other is conversion from a string
> to a double can run into representation issues.

Correct on both counts.


> I am not sure if it is worth addressing the first issue - microseconds
> may be sufficient for most purposes. In my code, I think I can limit
> the value to 6 decimal places fairly easily.

Yes, we have to pick some default value and microseconds seems like
a reasonable compromise. You always have an option to customize the
dateTime type and serialize the seconds component with your desired
precision.


> The representation issue isn't an issue for precision, but it certainly
> affects any comparison of types that rely on doubles. I'm not sure if
> there is a good answer here.

I don't think there is a practical solution to this one since that's
how floating point types work. So the only suggestion I can offer is
to choose floating point values for your test so that they don't
trigger this problem.

Boris




More information about the xsd-users mailing list