# Re: limits of the generic

```Perhaps there is an analogy between pinning and some aspect rounding of
floating point computations.

It seems there's something wrong with the pinning algorithm.  Probably,
there should be an attempt to do pinning only at the end of the computation
(by analogy with rounding) -- the idea of pinning to a valid date after
adding Y/M components, then later dealing with the day and time parts seems
of dubious merit.

Other examples of difficulty:

1.  Two datetimes can swap their order after each incrementing by the same
duration
2004-02-28T23:59 < 2002-02-29T00:00
but
2004-02-28T23:59 + P(1Y1D) > 2004-02-29T00:00 + P(1Y1D)
since these are
2005-03-01T23:59 and 2005-03-01T00:00 respectively.

2.  Given dates x and y and duration d
(x+d) - (y+d)  does not equal (x - y) in some pathological cases, like the
one above.

Jeff

----- Original Message -----
From: "Jeni Tennison" <jeni@j...>
To: "Jeff Greif" <jgreif@a...>
Cc: <xml-dev@l...>
Sent: Sunday, September 29, 2002 2:50 PM
Subject: Re:  limits of the generic

> Hi Jeff,
>
> > Yes, the comparison of these durations is determinate. However, it
> > is inconsistent with
> >
> >     2004-02-29 + P1Y1D > 2004-02-29 + P365D
> >
> > which is false according to the algorithm you described, (but would
> > be true for any starting date which is not 02-29 in a leap year). In
> > other words, I cannot deduce from x > y (P1Y1D > P365D) that a + x >
> > a + y. I realize its a different > operator (for durations vs.
> > dates), but if they are not defined consistently there is a problem.
>
> Ah, I see what you mean. It's not just a problem with xs:durations,
> though, rather a problem whenever there's "pinning" of the dates back
> to valid values. For example, even if you're just looking at
> xf:yearMonthDurations, you'd expect:
>
>   (2002-08-31 + P1M) + P1M
>
> to be equal to:
>
>   2002-08-31 + (P1M + P1M)
>
> but (according to the algorithm in the Datatypes Rec.):
>
>   (2002-08-31 + P1M) + P1M  =>  2002-09-30 + P1M  =>  2002-10-30
>
> whereas:
>
>   2002-08-31 + (P1M + P1M)  =>  2002-08-31 + P2M  =>  2002-10-31
>

```

### PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
 RSS 2.0 Atom 0.3 Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.