[e-lang] ordered-region comparison is broken

Allen Short washort at divmod.com
Fri Dec 21 14:04:10 EST 2007


Sure, sorry about the oversight.

Index: esrc/org/erights/e/elang/coord/OrderedRegionMaker.emaker
===================================================================
--- esrc/org/erights/e/elang/coord/OrderedRegionMaker.emaker	(revision 474)
+++ esrc/org/erights/e/elang/coord/OrderedRegionMaker.emaker	(working copy)
@@ -514,8 +514,8 @@
              * As a region, my comparison is a subset test.
              */
             to op__cmp(other) :float64 {
-                def selfExtra := (self & !other).isEmpty()
-                def otherExtra := (other & !self).isEmpty()
+                def selfExtra := !(self & !other).isEmpty()
+                def otherExtra := !(other & !self).isEmpty()
                 if (selfExtra) {
                     if (otherExtra) {
                         # Both have left-overs, so they're incomparable.
Index: esrc/scripts/test/updoc/orderedRegion.updoc
===================================================================
--- esrc/scripts/test/updoc/orderedRegion.updoc	(revision 0)
+++ esrc/scripts/test/updoc/orderedRegion.updoc	(revision 0)
@@ -0,0 +1,21 @@
+# Copyright 2007 Allen Short, under the terms of the MIT X license
+# found at http://www.opensource.org/licenses/mit-license.html
+
+Former bug: the sense of the 'isEmpty' tests in
+org.erights.e.elang.coord.OrderedRegionMaker$OrderedRegionMaker$self.op__cmp
+was reversed.
+
+? (1..10).op__cmp(1..10)
+# value: 0.0
+
+? (1..10).op__cmp(3..7)
+# value: 1.0
+
+?(1..10).op__cmp(1..20)
+#value: -1.0
+
+?(1..10).op__cmp(-10..10)
+#value: -1.0
+
+?(1..10).op__cmp(20..30)
+#value: NaN


More information about the e-lang mailing list