# Negative True and Negative False

## Recommended Posts

What does negative true mean? According to the interpreter it means True.

`If - True Then MsgBox(0, "", (- True = True))`

While this may have practical application, it still appears to be meaningless to say True = -True. True is niether positive nor negative. The question I want to ask is whether this is purely a design choice, or if there is some deeper signiicance to why the interpreter does not differentiate between positive and negative boolean values.

Perhaps I ought to follow the same indifference in my three value logic system, but I thought asking first might throw some new light on the subject. There still seem to be some holes in this particular bucket.

```MsgBox(0, "", (True = - True)) ; True
MsgBox(0, "", (True = Abs(- True))) ; True
MsgBox(0, "", (- True = Abs(- True))) ; False```

While it is clear to me what is going on internally, on the surface it appears to be a broken system (as far as logic is concerned). What are your thoughts?

Edited by czardas

##### Share on other sites

Traditionally in computing the definition of false is zero, and the definition of true is non zero. By applying a mathematical operation to a boolean value you are creating an integer value.

True = -True as both are non zero, and the comparison is a boolean one.

True = Abs(-True) is the same as above

-True != Abs(-True) as the comparison is now between two integers. -1 != 1

##### Share on other sites

Good explanation Mat. So do you suggest I ought to allow negative numbers and just ignore the sign in my new version of The current version rejects them. From my own perspective it makes no difference, however I fail to see the justification for allowing negatives. It seems improper use and ought really to throw an exception.

Edited by czardas

##### Share on other sites

Don't bother to be honest. There is no reason to try and convert from boolean values to integers.

Edit: Commas are quite important sometimes. You should always try and be honest.

Edited by Mat

##### Share on other sites

Edit: Commas are quite important sometimes. You should always try and be honest.

Thanks for your opinion. I edited out two commas from my previous post.

Edited by czardas

##### Share on other sites

There was a time where True and False weren't keywords in AutoIt. You simply used zero and non-zero like C/C++.

##### Share on other sites

Thanks for your opinion. I edited out two commas from my previous post.

I meant:

Don't bother to be honest.

##### Share on other sites

It wasn't a pythagorean comma then.

I won't alter it unless I can find justification for doing so, which actually I can't.

Edited by czardas

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...