Page 1 of 1

[13.11] Comparing no signal in "Everything" returns true generaly

Posted: Fri Jul 29, 2016 6:21 pm
by arl85
I already commented on it here but it seems to be considered "not a bug".
Still I'm sure it's a bug.

when you have no signal on a circuit any comparison with "Everything" signal returns true.

Image

I expect to receive false, because no signal passes comparison.

Maybe check is performed this way?

Code: Select all

output= true
for each signal on circuit
      if condition is false then
      output = false
      exit loop
loop
return output

Re: [13.11] Comparing no signal in "Everything" returns true generaly

Posted: Sat Jul 30, 2016 6:08 pm
by TruePikachu
This is not a bug. "Everything" ignores signals with a value of zero, by design.

EDIT: Just reread, still not a bug. All nonzero signals passed the condition. If you want to have false when everything is zero, multiply the "everything" output by the comparison "anything != 0".

EDIT: This is also true by convention; default for AND is TRUE just as default for addition is zero and multiplication is one.

`1+2` ≡ `0+1+2` ∴ `` ≡ `0`
`2*3` ≡ `1*2*3` ∴ `` ≡ `1`
`a⋁b` ≡ `F⋁a⋁b` ∴ `` ≡ `F`
`a⋀b` ≡ `T⋀a⋀b` ∴ `` ≡ `T`

Lisp also agrees with this logic (NIL ≡ F).

Code: Select all

[1]> (+) ; zero-arg addition
0
[2]> (*) ; zero-arg multiplication
1
[3]> (or) ; zero-arg boolean OR
NIL
[4]> (and) ; zero-arg boolean AND
T

Re: [13.11] Comparing no signal in "Everything" returns true generaly

Posted: Sat Jul 30, 2016 7:51 pm
by Loewchen
Yeah, this is the correct behaviour following the definition.