On 12/18/13 12:58 AM, "Ola Fosheim Grøstad"
<[email protected]>" wrote:
On Wednesday, 18 December 2013 at 02:17:06 UTC, Andrei Alexandrescu wrote:
On 12/17/13 5:58 PM, "Ola Fosheim Grøstad"
<[email protected]>" wrote:
Why is that? I would think that 10 == Interval(10,10), but
interval(5,100).contains(10) ?
Yah, defining == my way would make it non-transitive.
True interval arithmetic is difficult to
implement though, since !(a<b) does not imply (a>=b) if I got it right…
I didn't peruse the wikipedia page in detail but it seems a lot of
interval arithmetic is well-defined.
But it is counter-intuitive since an interval represent uncertainty?
[5,5] == [5,5] => true
[1,5] != [1,5] => false? // counter-intuitive
Within the tolerance allowed, they are equal.
[0,5] < [6,10] => true
[0,5] < [2,10] => uncertain
That would be false.
The whole trick is to define primitives such that they have the
fundamental properties (transitivity, (anti-)symmetry etc).
So you you might have to introduce a tri-boolean type
That would be good too for distinct reasons.
I wrote libraries for both tribool and fuzzybool
There's been a discussion on fast tristate logic recently in here.
Andrei