<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=Mathematical_operators_to_replace_logical_operators</id>
	<title>Mathematical operators to replace logical operators - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=Mathematical_operators_to_replace_logical_operators"/>
	<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Mathematical_operators_to_replace_logical_operators&amp;action=history"/>
	<updated>2026-04-24T17:22:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://www.ninerpedia.org/index.php?title=Mathematical_operators_to_replace_logical_operators&amp;diff=48821&amp;oldid=prev</id>
		<title>Stephen Shaw: /* Value of TRUE and FALSE */  add note re IF X THEN 100</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Mathematical_operators_to_replace_logical_operators&amp;diff=48821&amp;oldid=prev"/>
		<updated>2014-11-02T10:51:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Value of TRUE and FALSE: &lt;/span&gt;  add note re IF X THEN 100&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:51, 2 November 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Value of TRUE and FALSE==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Value of TRUE and FALSE==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The instruction IF X=1 THEN 100 is acted upon by the computer only if the expression (X=1) is TRUE. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;A TRUE expression is &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;treated by the computer as having &lt;/del&gt;a value of -1&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;while a FALSE expression is &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;treated as having &lt;/del&gt;a value of 0.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The instruction IF X=1 THEN 100 is acted upon by the computer only if the expression (X=1) is TRUE.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A TRUE expression is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;given  &lt;/ins&gt;a value of -1 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;while a FALSE expression is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;given a value of zero.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;As the transfer test is looking for a value of not zero, a slightly different test would be &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; IF X THEN 100 ELSE 200&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;If the value of X is 0 then the line will transfer to 200, but if X has any value other than zero the transfer will go to 100.  Instead of seeing a value of 0 if (X=1) is false we are seeing &lt;/ins&gt;a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;simple &lt;/ins&gt;value of 0.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==TRUE value for line transfers==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==TRUE value for line transfers==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Stephen Shaw</name></author>
	</entry>
	<entry>
		<id>http://www.ninerpedia.org/index.php?title=Mathematical_operators_to_replace_logical_operators&amp;diff=48410&amp;oldid=prev</id>
		<title>Stephen Shaw: New article on TI BASIC logical operators</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Mathematical_operators_to_replace_logical_operators&amp;diff=48410&amp;oldid=prev"/>
		<updated>2014-09-10T17:34:32Z</updated>

		<summary type="html">&lt;p&gt;New article on TI BASIC logical operators&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;TI Basic Programming:&lt;br /&gt;
&lt;br /&gt;
One omission from TI Basic is the lack of logical operators such as AND and OR used for example in expressions such as IF V&amp;lt;8 AND W&amp;gt;4 THEN 120 ELSE 240. TI Basic programmers instead used mathematical operators to replace logical operators.&lt;br /&gt;
&lt;br /&gt;
Another omission was that such comparisons could only lead to a line transfer instead of a command.   TI BASIC did not allow IF V&amp;lt;8 THEN W=4.&lt;br /&gt;
&lt;br /&gt;
These omissions were dealt with in Extended Basic.&lt;br /&gt;
&lt;br /&gt;
However, TI BASIC does have &amp;#039;relational operators&amp;#039; which will often help you out of this problem.&lt;br /&gt;
&lt;br /&gt;
==Value of TRUE and FALSE==&lt;br /&gt;
The instruction IF X=1 THEN 100 is acted upon by the computer only if the expression (X=1) is TRUE.  A TRUE expression is treated by the computer as having a value of -1, while a FALSE expression is treated as having a value of 0. &lt;br /&gt;
&lt;br /&gt;
==TRUE value for line transfers==&lt;br /&gt;
The IF..THEN structure does not require an expression to evaluate to 0 or -1 however, as any value other than 0 is treated as TRUE for line transfer purposes. &lt;br /&gt;
&lt;br /&gt;
You may also use a variable on its own to perform a line transfer: &lt;br /&gt;
&lt;br /&gt;
IF X&amp;lt;&amp;gt;0 THEN 100 will transfer to line 100 if the variable X has any value. &lt;br /&gt;
&lt;br /&gt;
IF X THEN 100 will have exactly the same effect but use less memory. &lt;br /&gt;
&lt;br /&gt;
==Replacement for AND==&lt;br /&gt;
It is possible in TI BASIC to build up a set of expressions in an IF...THEN line, which will simulate OR and AND, and if you are careful, you may go well beyond OR and AND.&lt;br /&gt;
&lt;br /&gt;
Each expression to be evaluated MUST appear in brackets.&lt;br /&gt;
For example: IF (A=1)+(B=10) THEN 100 may be interpreted as IF A=1 OR B=10 THEN 100.&lt;br /&gt;
&lt;br /&gt;
If both A=1 and B=10, then the sum of the two expressions is -2, (-1 plus -1), and as the result is not zero, the transfer to line 100 will take place.&lt;br /&gt;
&lt;br /&gt;
If only A=1, but B=5, then the sum will be (-1+0) or -1, and the transfer will still take place.&lt;br /&gt;
&lt;br /&gt;
If A=3 and B=5, then the sum is (0+0) or 0, and the transfer to line 100 will not occur.&lt;br /&gt;
 &lt;br /&gt;
What we have then is a way of saying IF A=1 OR B=10 THEN 100    (dont type this line in).&lt;br /&gt;
&lt;br /&gt;
==Replacement for OR==&lt;br /&gt;
&lt;br /&gt;
Using a different mathematical operation, the multiply or *:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IF (A=3)*(B=2) THEN 100&lt;br /&gt;
&lt;br /&gt;
When A=3 and B=2, the calculation is (-1 * -1) or +1.&lt;br /&gt;
&lt;br /&gt;
The result is none zero and the line transfer takes place.&lt;br /&gt;
&lt;br /&gt;
When A=3 and B=1, the calculation is (-1 * 0) or 0&lt;br /&gt;
&lt;br /&gt;
The result is zero so no transfer will occur.&lt;br /&gt;
&lt;br /&gt;
What we now have is a way of saying,in TI Basic: IF A=3 AND B=2 THEN 100.&lt;br /&gt;
                &lt;br /&gt;
==More complexity possible==&lt;br /&gt;
Provided you are careful to always know the possible results of the various expressions and mathematical operations, you may build up some very powerful IF...THEN commands, which will save you many lines of tedious programming.&lt;br /&gt;
&lt;br /&gt;
===Setting Variables using logical operations===&lt;br /&gt;
This however is not all you can do with relational expressions. How about trying to program IF A=5 THEN B=6 ELSE B=0 in TI Basic? &lt;br /&gt;
&lt;br /&gt;
B=-6*(A=5) has exactly this result. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If (A=5) then the calculation is B=-6*-1, or B=6. &lt;br /&gt;
&lt;br /&gt;
If A does not equal five, the calculation is B=-6*0, or B=0. &lt;br /&gt;
&lt;br /&gt;
All you need is to keep track of the possible values of the variables you use. &lt;br /&gt;
&lt;br /&gt;
===Multiple Variable comparisons===&lt;br /&gt;
To whet your appetite: IF (X=1)+(Y=1)+(Z=1)=-2 THEN 100&lt;br /&gt;
&lt;br /&gt;
This interesting group of expressions will transfer to line 100 if any two of the three bracketed expressions is true but NOT transfer if zero, one or three variables have a value of 1. &lt;br /&gt;
&lt;br /&gt;
What this fairly short line says to the computer is: &lt;br /&gt;
&lt;br /&gt;
If any two of X Y &amp;amp; Z are equal to one then... &lt;br /&gt;
&lt;br /&gt;
===Using &amp;lt; and &amp;gt;===&lt;br /&gt;
As well as testing for equality you can test for greater than(&amp;gt;) and less than(&amp;lt;) or even &amp;quot;less than or equal to&amp;quot; (&amp;lt;=) and &amp;quot;greater than or equal to&amp;quot; (&amp;gt;=).&lt;br /&gt;
&lt;br /&gt;
By keeping track of the variations in values following comparisons you can build up some powerful and memory saving routines.&lt;br /&gt;
&lt;br /&gt;
==String Variables==&lt;br /&gt;
The same structures can be used with string variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Stephen Shaw</name></author>
	</entry>
</feed>