Re: ordered-region comparison is broken

Allen Short <washort-TyWPi3/[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <20071221190410.8162.2077054573.divmod.quotient.47863@ohm>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.