Doc #73770 [Opn]: Truth table errors

From: Date: Sat, 17 Dec 2016 11:41:21 +0000
Subject: Doc #73770 [Opn]: Truth table errors
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14252@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73770&edit=1 ID: 73770 Updated by: requinix@php.net Reported by: rjhdby@php.net Summary: Truth table errors Status: Open Type: Documentation Problem -Package: Documentation problem +Package: COM related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: When I try foreach ([true, false, null] as $i) foreach ([true, false, null] as $j) { $v = variant_imp($i, $j); $v = (variant_get_type($v) == VT_NULL ? null : (int)$v); printf("variant_imp(%s, %s) = %s\n", json_encode($i), json_encode($j), json_encode($v)); } I get variant_imp(true, true) = -1 variant_imp(true, false) = 0 variant_imp(true, null) = null variant_imp(false, true) = -1 variant_imp(false, false) = -1 variant_imp(false, null) = -1 variant_imp(null, true) = -1 variant_imp(null, false) = null variant_imp(null, null) = null true->false should be false ("true implies false" is wrong). true->null, null->false, and null->null should all be unknown. Previous Comments: ------------------------------------------------------------------------ [2016-12-17 09:12:19] rjhdby@php.net Description: ------------ --- From manual page: http://www.php.net/function.variant-imp --- Truth table for bitwise implication is not correct. Must be If left is If right is then the result is TRUE TRUE TRUE TRUE FALSE TRUE >> FALSE TRUE NULL TRUE >> FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE NULL TRUE NULL TRUE TRUE NULL FALSE NULL >> TRUE NULL NULL NULL >> TRUE ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73770&edit=1

« previous php.doc.bugs (#14252) next »