Download

Bug: NAND gate inaccurate if more than 2 inputs

Hi Epic team,

I found a bug in the blueprint NAND gate, which I believe should be easy to fix. It returns wrong results if used with more than one input. This is what it does now:

false false false = true (correct)
false false true = false (wrong)
false true false = true (correct)
false true true = false (wrong)
true false false = true (correct)
true false true = false (wrong)
true true false = true (correct)
true true true = true (wrong)

Similar behaviour happens for 4 inputs.

Not a big deal as it’s easy to replicate the correct behaviour through a AND + NOT obviously. The only issue is the time wasted in debugging until you figure out what is going on.

Best,
A

If it’s a bug post it on answerhub instead.

NAND: a Boolean operator that gives the value zero if and only if all the operands have a value of one, and otherwise has a value of one (equivalent to NOT AND).

Just in case you aren’t familiar with what it’s supposed to do. Basically, if everything is True it outputs False otherwise it outputs True.

True, True, True = False (aka 0) Edit: And to be clear this is the only way False or 0 is ever the output
False, False, False = True (aka 1)
True, False, False = True (aka 1)

So yes, something’s wrong. And arguably I’m not even sure if the intended behavior is very useful. NAND’s intended behavior isn’t at all what I’d expect. It makes sense when I think about it, that is, I should be “NOT” ‘ing’ my inputs rather than the output.

So if I wanted to continue only if DoStop,DontGo,IsStunned are all false I wouldn’t want a NAND (actually I’d assume I would want a NOR but now I’ll have to look that up) I’d want:
if Not(DoStop) && Not(DontGo) && Not(IsStunned)

Forgive my psuedo code. I’d have used ‘!IsStunned’ but readability for non-coders is more important imo

NOR - a Boolean operator that gives the value one if and only if all operands have a value of zero and otherwise has a value of zero.
^ So yes, that one.

Hey! Thanks for the report! Could you please post it to the Bug Reports section of answers.unrealengine.com? It would be really helpful. I don’t see a bug in for this yet, so it’s news to us.

Cheers!