POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 13:10:43 EDT (-0400)
  Re: Games programmers  
From: andrel
Date: 12 Sep 2008 18:04:35
Message: <48CAE7B9.80509@hotmail.com>
On 12-Sep-08 23:01, Vincent Le Chevalier wrote:
> andrel a écrit :
>> On 12-Sep-08 21:14, Vincent Le Chevalier wrote:
>>> There is also a similarity between the behaviours of positive 
>>> integers, multiplication and addition, and booleans, AND and OR. That 
>>> is:
>>>
>>>  Integers            Booleans
>>> a*(b+c) = a*b + a*c        a AND (b OR c) = (a AND b) OR (a AND c)
>>> 0 + a = a            false OR a = a
>>> 0 * a = 0            false AND a = false
>>> if a>0, a+b>0 for all b        if a is true, a OR b is true for all b
>>> And so on...
>>>
>>> It does not work out that well if you set true <-> 0.
>>>
>> If you take
>>   true <-> 0
>>   false <-> 1
>>   OR <-> *
>>   AND <-> +
>> it works again.
> 
> No, it's not as perfect. For example the equality:
> (a AND b) OR (a AND c) = a AND (b OR c)
> 
> would translate as:
> (a+b) * (a+c) = a*a + a*b + a*c + b*c
>     = a * (1+b+c) + b*c
>     != a + b*c
> 
> because 1+b+c is not equal to 1 in all cases.

I think that should have been a+b+c. Anyway, the same argument could be 
given for (a OR b) AND (a OR c) = a OR (b AND C) in the standard 
interpretation.

> 
> I agree it works in the boolean sense, that is if one side is zero, the 
> other is too. But you do not have the equality that you have in the 
> other approach.
> 
> I'm nearly sure there is a deeper reason for that but I can't think of 
> it right now.

Both interpretations should be interchangeable because of de Morgan's 
law. I hope that is deep enough for you. ;)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.