Reverse order of arguments to DATEDIFF, for compatibility. Thanks to
authorBen Pfaff <blp@gnu.org>
Sat, 16 Dec 2006 20:22:14 +0000 (20:22 +0000)
committerBen Pfaff <blp@gnu.org>
Sat, 16 Dec 2006 20:22:14 +0000 (20:22 +0000)
Daniel Williams <Daniel.E.Williams@state.or.us> for reporting this
bug.

doc/expressions.texi
src/language/expressions/ChangeLog
src/language/expressions/helpers.c
src/language/expressions/operations.def
tests/ChangeLog
tests/expressions/expressions.sh

index 540cad220ef4492e2b65fca73f02ebb80f283302..a03a2fd432359d928c68d2905267a609fadef919 100644 (file)
@@ -1027,7 +1027,7 @@ before performing analysis.
 
 PSPP supplies a few functions for date arithmetic:
 
-@deftypefn {Function} {} DATEDIFF (@var{date1}, @var{date2}, @var{unit})
+@deftypefn {Function} {} DATEDIFF (@var{date2}, @var{date1}, @var{unit})
 Returns the span of time from @var{date1} to @var{date2} in terms of
 @var{unit}, which must be a quoted string, one of @samp{years},
 @samp{quarters}, @samp{months}, @samp{weeks}, @samp{days},
index a55b977f863d8c1ccefc8ea275e0b941edd90490..98df4a36e43af697f9ac6ac697ab1f7e09eebf5e 100644 (file)
@@ -1,4 +1,8 @@
-Wed Dec 13 19:33:52 2006  Ben Pfaff  <blp@gnu.org>
+Sat Dec 16 12:20:14 2006  Ben Pfaff  <blp@gnu.org>
+
+       * operations.def: Reverse order of arguments to DATEDIFF, for
+       compatibility.  Thanks to Daniel Williams
+       <Daniel.E.Williams@state.or.us> for reporting this bug.
 
 Wed Dec 13 19:30:26 2006  Ben Pfaff  <blp@gnu.org>
 
index a07282be16d836a21a6744d6573583c9ce9dc2d3..08986b298ccdd2a8deb5fe8d298bcd79ae2e6ab6 100644 (file)
@@ -261,7 +261,7 @@ date_unit_duration (enum date_unit unit)
     }
 }
 
-/* Returns the span from DATE to DATE2 in terms of UNIT_NAME. */
+/* Returns the span from DATE1 to DATE2 in terms of UNIT_NAME. */
 double
 expr_date_difference (double date1, double date2, struct substring unit_name) 
 {
index 05d6e8045887f27c711a3f4e312235f432925960..59f2493e878f644d05a64ebfd7cf22287991f0b0 100644 (file)
@@ -318,7 +318,7 @@ function XDATE.WKDAY (date >= DAY_S) = calendar_offset_to_wday (date / DAY_S);
 function XDATE.YEAR (date >= DAY_S) = calendar_offset_to_year (date / DAY_S);
 
 // Date arithmetic functions.
-no_abbrev function DATEDIFF (date1 >= DAY_S, date2 >= DAY_S, string unit)
+no_abbrev function DATEDIFF (date2 >= DAY_S, date1 >= DAY_S, string unit)
      = expr_date_difference (date1, date2, unit);
 no_abbrev function DATESUM (date, quantity, string unit)
      = expr_date_sum (date, quantity, unit, ss_cstr ("closest"));
index fe424a1ee9d708ac75da0ab0031be924c1e13013..a1375802086f679ca0dc8b6057353ae30da4d8d6 100644 (file)
@@ -1,3 +1,8 @@
+Sat Dec 16 12:20:58 2006  Ben Pfaff  <blp@gnu.org>
+
+       * expressions/expressions.sh: Fix DATEDIFF function tests to
+       correspond with change to DATEDIFF.
+
 Wed Dec 13 19:34:29 2006  Ben Pfaff  <blp@gnu.org>
 
        * expressions/expressions.sh: Test DATEDIFF, DATESUM functions.
index 88c9bafae9b0b1d89d386d9ef884ec4469624ff5..c87148946b75bb788a2d2103b5b29a1f4203d8e1 100755 (executable)
@@ -1261,189 +1261,189 @@ xdate.year(date.mdy(2,25,96) + time.hms(21,30,57)) => 1996.00
 xdate.year(date.mdy(11,10,2038) + time.hms(22,30,4)) => 2038.00
 xdate.year(date.mdy(7,18,2094) + time.hms(1,56,51)) => 2094.00
 
-datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'years') => 32.00
-datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'years') => 36.00
-datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'years') => 51.00
-datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'years') => 51.00
-datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'years') => 19.00
-datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'years') => 64.00
-datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'years') => 26.00
-datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'years') => 12.00
-datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'years') => 1.00
+datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'years') => -32.00
+datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'years') => -36.00
+datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'years') => -51.00
+datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'years') => -51.00
+datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'years') => -19.00
+datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'years') => -64.00
+datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'years') => -26.00
+datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'years') => -12.00
+datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'years') => -1.00
 datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'years') => 0.00
-datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'years') => 48.00
-datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'years') => 3.00
-datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'years') => 54.00
-datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'years') => 1.00
+datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'years') => -48.00
+datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'years') => -3.00
+datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'years') => -54.00
+datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'years') => -1.00
 datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'years') => 0.00
-datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'years') => 48.00
-datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'years') => 3.00
-datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'years') => 42.00
-datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'years') => 55.00
-datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'years') => 3.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'years') => 4.00
-datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'years') => 2.00
-
-datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'quarters') => 128.00
-datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'quarters') => 144.00
-datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'quarters') => 207.00
-datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'quarters') => 204.00
-datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'quarters') => 78.00
-datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'quarters') => 256.00
-datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'quarters') => 105.00
-datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'quarters') => 48.00
-datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'quarters') => 6.00
-datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'quarters') => 1.00
-datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'quarters') => 193.00
-datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'quarters') => 15.00
-datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'quarters') => 217.00
-datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'quarters') => 6.00
-datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'quarters') => 1.00
-datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'quarters') => 193.00
-datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'quarters') => 15.00
-datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'quarters') => 170.00
-datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'quarters') => 222.00
-datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'quarters') => 15.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'quarters') => 16.00
-datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'quarters') => 11.00
-
-datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'months') => 384.00
-datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'months') => 432.00
-datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'months') => 622.00
-datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'months') => 613.00
-datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'months') => 235.00
-datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'months') => 768.00
-datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'months') => 316.00
-datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'months') => 145.00
-datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'months') => 18.00
-datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'months') => 5.00
-datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'months') => 581.00
-datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'months') => 47.00
-datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'months') => 652.00
-datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'months') => 18.00
-datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'months') => 5.00
-datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'months') => 581.00
-datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'months') => 47.00
-datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'months') => 512.00
-datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'months') => 668.00
-datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'months') => 47.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'months') => 48.00
-datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'months') => 35.00
-
-datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'weeks') => 1672.00
-datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'weeks') => 1881.00
-datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'weeks') => 2708.00
-datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'weeks') => 2667.00
-datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'weeks') => 1025.00
-datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'weeks') => 3342.00
-datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'weeks') => 1375.00
-datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'weeks') => 631.00
-datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'weeks') => 81.00
-datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'weeks') => 24.00
-datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'weeks') => 2527.00
-datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'weeks') => 205.00
-datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'weeks') => 2838.00
-datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'weeks') => 81.00
-datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'weeks') => 24.00
-datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'weeks') => 2527.00
-datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'weeks') => 205.00
-datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'weeks') => 2228.00
-datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'weeks') => 2905.00
-datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'weeks') => 208.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'weeks') => 208.00
-datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'weeks') => 156.00
-
-datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'days') => 11708.00
-datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'days') => 13172.00
-datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'days') => 18958.00
-datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'days') => 18670.00
-datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'days') => 7177.00
-datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'days') => 23398.00
-datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'days') => 9625.00
-datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'days') => 4418.00
-datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'days') => 567.00
-datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'days') => 171.00
-datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'days') => 17694.00
-datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'days') => 1440.00
-datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'days') => 19872.00
-datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'days') => 567.00
-datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'days') => 171.00
-datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'days') => 17694.00
-datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'days') => 1440.00
-datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'days') => 15599.00
-datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'days') => 20339.00
-datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'days') => 1460.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'days') => 1461.00
-datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'days') => 1094.00
-
-datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'years') => -32.00
-datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'years') => -36.00
-datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'years') => -51.00
-datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'years') => -51.00
-datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'years') => -19.00
-datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'years') => -64.00
-datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'years') => -26.00
-datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'years') => -12.00
-datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'years') => -1.00
+datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'years') => -48.00
+datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'years') => -3.00
+datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'years') => -42.00
+datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'years') => -55.00
+datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'years') => -3.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'years') => -4.00
+datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'years') => -2.00
+
+datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'quarters') => -128.00
+datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'quarters') => -144.00
+datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'quarters') => -207.00
+datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'quarters') => -204.00
+datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'quarters') => -78.00
+datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'quarters') => -256.00
+datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'quarters') => -105.00
+datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'quarters') => -48.00
+datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'quarters') => -6.00
+datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'quarters') => -1.00
+datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'quarters') => -193.00
+datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'quarters') => -15.00
+datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'quarters') => -217.00
+datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'quarters') => -6.00
+datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'quarters') => -1.00
+datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'quarters') => -193.00
+datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'quarters') => -15.00
+datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'quarters') => -170.00
+datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'quarters') => -222.00
+datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'quarters') => -15.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'quarters') => -16.00
+datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'quarters') => -11.00
+
+datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'months') => -384.00
+datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'months') => -432.00
+datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'months') => -622.00
+datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'months') => -613.00
+datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'months') => -235.00
+datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'months') => -768.00
+datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'months') => -316.00
+datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'months') => -145.00
+datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'months') => -18.00
+datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'months') => -5.00
+datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'months') => -581.00
+datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'months') => -47.00
+datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'months') => -652.00
+datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'months') => -18.00
+datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'months') => -5.00
+datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'months') => -581.00
+datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'months') => -47.00
+datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'months') => -512.00
+datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'months') => -668.00
+datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'months') => -47.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'months') => -48.00
+datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'months') => -35.00
+
+datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'weeks') => -1672.00
+datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'weeks') => -1881.00
+datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'weeks') => -2708.00
+datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'weeks') => -2667.00
+datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'weeks') => -1025.00
+datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'weeks') => -3342.00
+datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'weeks') => -1375.00
+datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'weeks') => -631.00
+datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'weeks') => -81.00
+datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'weeks') => -24.00
+datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'weeks') => -2527.00
+datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'weeks') => -205.00
+datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'weeks') => -2838.00
+datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'weeks') => -81.00
+datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'weeks') => -24.00
+datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'weeks') => -2527.00
+datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'weeks') => -205.00
+datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'weeks') => -2228.00
+datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'weeks') => -2905.00
+datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'weeks') => -208.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'weeks') => -208.00
+datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'weeks') => -156.00
+
+datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'days') => -11708.00
+datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'days') => -13172.00
+datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'days') => -18958.00
+datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'days') => -18670.00
+datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'days') => -7177.00
+datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'days') => -23398.00
+datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'days') => -9625.00
+datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'days') => -4418.00
+datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'days') => -567.00
+datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'days') => -171.00
+datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'days') => -17694.00
+datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'days') => -1440.00
+datediff(date.mdy(9,29,41), date.mdy(2,25,1996), 'days') => -19872.00
+datediff(date.mdy(9,29,41), date.mdy(4,19,43), 'days') => -567.00
+datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'days') => -171.00
+datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'days') => -17694.00
+datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'days') => -1440.00
+datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'days') => -15599.00
+datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'days') => -20339.00
+datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'days') => -1460.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'days') => -1461.00
+datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'days') => -1094.00
+
+datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'years') => 32.00
+datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'years') => 36.00
+datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'years') => 51.00
+datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'years') => 51.00
+datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'years') => 19.00
+datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'years') => 64.00
+datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'years') => 26.00
+datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'years') => 12.00
+datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'years') => 1.00
 datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'years') => 0.00
-datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'years') => -48.00
-datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'years') => -3.00
-datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'years') => -54.00
-datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'years') => -1.00
+datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'years') => 48.00
+datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'years') => 3.00
+datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'years') => 54.00
+datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'years') => 1.00
 datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'years') => 0.00
-datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'years') => -48.00
-datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'years') => -3.00
-datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'years') => -42.00
-datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'years') => -55.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'years') => -3.00
-datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'years') => -4.00
-datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'years') => -2.00
-
-datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'months') => -384.00
-datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'months') => -432.00
-datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'months') => -622.00
-datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'months') => -613.00
-datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'months') => -235.00
-datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'months') => -768.00
-datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'months') => -316.00
-datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'months') => -145.00
-datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'months') => -18.00
-datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'months') => -5.00
-datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'months') => -581.00
-datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'months') => -47.00
-datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'months') => -652.00
-datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'months') => -18.00
-datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'months') => -5.00
-datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'months') => -581.00
-datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'months') => -47.00
-datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'months') => -512.00
-datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'months') => -668.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'months') => -47.00
-datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'months') => -48.00
-datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'months') => -35.00
-
-datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'quarters') => -128.00
-datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'quarters') => -144.00
-datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'quarters') => -207.00
-datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'quarters') => -204.00
-datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'quarters') => -78.00
-datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'quarters') => -256.00
-datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'quarters') => -105.00
-datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'quarters') => -48.00
-datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'quarters') => -6.00
-datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'quarters') => -1.00
-datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'quarters') => -193.00
-datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'quarters') => -15.00
-datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'quarters') => -217.00
-datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'quarters') => -6.00
-datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'quarters') => -1.00
-datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'quarters') => -193.00
-datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'quarters') => -15.00
-datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'quarters') => -170.00
-datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'quarters') => -222.00
-datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'quarters') => -15.00
-datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'quarters') => -16.00
-datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters') => -11.00
+datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'years') => 48.00
+datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'years') => 3.00
+datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'years') => 42.00
+datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'years') => 55.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'years') => 3.00
+datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'years') => 4.00
+datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'years') => 2.00
+
+datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'months') => 384.00
+datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'months') => 432.00
+datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'months') => 622.00
+datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'months') => 613.00
+datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'months') => 235.00
+datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'months') => 768.00
+datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'months') => 316.00
+datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'months') => 145.00
+datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'months') => 18.00
+datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'months') => 5.00
+datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'months') => 581.00
+datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'months') => 47.00
+datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'months') => 652.00
+datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'months') => 18.00
+datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'months') => 5.00
+datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'months') => 581.00
+datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'months') => 47.00
+datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'months') => 512.00
+datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'months') => 668.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'months') => 47.00
+datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'months') => 48.00
+datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'months') => 35.00
+
+datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'quarters') => 128.00
+datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'quarters') => 144.00
+datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'quarters') => 207.00
+datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'quarters') => 204.00
+datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'quarters') => 78.00
+datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'quarters') => 256.00
+datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'quarters') => 105.00
+datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'quarters') => 48.00
+datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'quarters') => 6.00
+datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'quarters') => 1.00
+datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'quarters') => 193.00
+datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'quarters') => 15.00
+datediff(date.mdy(2,25,1996), date.mdy(9,29,41), 'quarters') => 217.00
+datediff(date.mdy(4,19,43), date.mdy(9,29,41), 'quarters') => 6.00
+datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'quarters') => 1.00
+datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'quarters') => 193.00
+datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'quarters') => 15.00
+datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'quarters') => 170.00
+datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'quarters') => 222.00
+datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'quarters') => 15.00
+datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'quarters') => 16.00
+datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters') => 11.00
 
 # DATESUM with non-leap year
 ctime.days(datesum(date.mdy(1,31,1900), 1, 'months') - date.mdy(1,1,1900)) => 58.00