Jump to content
Sign in to follow this  
czardas

Negative True and Negative False

Recommended Posts

czardas

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 this post


Link to post
Share on other sites
Mat

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 this post


Link to post
Share on other sites
czardas

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 this post


Link to post
Share on other sites
Mat

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 this post


Link to post
Share on other sites
czardas

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. :shifty:

Edited by czardas

Share this post


Link to post
Share on other sites
Richard Robertson

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

Share this post


Link to post
Share on other sites
guinness

WOw, that must have been a very long time ago.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
czardas

It wasn't a pythagorean comma then. :D

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

Edited by czardas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×