/usr/share/doc/octave/octave.html/Comparison-Ops.html is in octave-doc 4.2.2-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Comparison Ops (GNU Octave)</title>
<meta name="description" content="Comparison Ops (GNU Octave)">
<meta name="keywords" content="Comparison Ops (GNU Octave)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Expressions.html#Expressions" rel="up" title="Expressions">
<link href="Boolean-Expressions.html#Boolean-Expressions" rel="next" title="Boolean Expressions">
<link href="Arithmetic-Ops.html#Arithmetic-Ops" rel="prev" title="Arithmetic Ops">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<a name="Comparison-Ops"></a>
<div class="header">
<p>
Next: <a href="Boolean-Expressions.html#Boolean-Expressions" accesskey="n" rel="next">Boolean Expressions</a>, Previous: <a href="Arithmetic-Ops.html#Arithmetic-Ops" accesskey="p" rel="prev">Arithmetic Ops</a>, Up: <a href="Expressions.html#Expressions" accesskey="u" rel="up">Expressions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Comparison-Operators"></a>
<h3 class="section">8.4 Comparison Operators</h3>
<a name="index-comparison-expressions"></a>
<a name="index-expressions_002c-comparison"></a>
<a name="index-relational-operators"></a>
<a name="index-operators_002c-relational"></a>
<a name="index-less-than-operator"></a>
<a name="index-greater-than-operator"></a>
<a name="index-equality-operator"></a>
<a name="index-tests-for-equality"></a>
<a name="index-equality_002c-tests-for"></a>
<p><em>Comparison operators</em> compare numeric values for relationships
such as equality. They are written using
<em>relational operators</em>.
</p>
<p>All of Octave’s comparison operators return a value of 1 if the
comparison is true, or 0 if it is false. For matrix values, they all
work on an element-by-element basis. Broadcasting rules apply.
See <a href="Broadcasting.html#Broadcasting">Broadcasting</a>. For example:
</p>
<div class="example">
<pre class="example">[1, 2; 3, 4] == [1, 3; 2, 4]
⇒ 1 0
0 1
</pre></div>
<p>According to broadcasting rules, if one operand is a scalar and the
other is a matrix, the scalar is compared to each element of the matrix
in turn, and the result is the same size as the matrix.
</p>
<dl compact="compact">
<dt><code><var>x</var> < <var>y</var></code></dt>
<dd><a name="index-_003c"></a>
<p>True if <var>x</var> is less than <var>y</var>.
</p>
</dd>
<dt><code><var>x</var> <= <var>y</var></code></dt>
<dd><a name="index-_003c_003d"></a>
<p>True if <var>x</var> is less than or equal to <var>y</var>.
</p>
</dd>
<dt><code><var>x</var> == <var>y</var></code></dt>
<dd><a name="index-_003d_003d"></a>
<p>True if <var>x</var> is equal to <var>y</var>.
</p>
</dd>
<dt><code><var>x</var> >= <var>y</var></code></dt>
<dd><a name="index-_003e_003d"></a>
<p>True if <var>x</var> is greater than or equal to <var>y</var>.
</p>
</dd>
<dt><code><var>x</var> > <var>y</var></code></dt>
<dd><a name="index-_003e"></a>
<p>True if <var>x</var> is greater than <var>y</var>.
</p>
</dd>
<dt><code><var>x</var> != <var>y</var></code></dt>
<dt><code><var>x</var> ~= <var>y</var></code></dt>
<dd><a name="index-_0021_003d"></a>
<a name="index-_007e_003d"></a>
<p>True if <var>x</var> is not equal to <var>y</var>.
</p></dd>
</dl>
<p>For complex numbers, the following ordering is defined:
<var>z1</var> < <var>z2</var>
if and only if
</p>
<div class="example">
<pre class="example"> abs (<var>z1</var>) < abs (<var>z2</var>)
|| (abs (<var>z1</var>) == abs (<var>z2</var>) && arg (<var>z1</var>) < arg (<var>z2</var>))
</pre></div>
<p>This is consistent with the ordering used by <em>max</em>, <em>min</em> and
<em>sort</em>, but is not consistent with <small>MATLAB</small>, which only compares the real
parts.
</p>
<p>String comparisons may also be performed with the <code>strcmp</code>
function, not with the comparison operators listed above.
See <a href="Strings.html#Strings">Strings</a>.
</p>
<a name="index-_003d_003d-1"></a>
<a name="XREFeq"></a><dl>
<dt><a name="index-eq"></a>: <em></em> <strong>eq</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>Return true if the two inputs are equal.
</p>
<p>This function is equivalent to <code><var>x</var> == <var>y</var></code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFne">ne</a>, <a href="#XREFisequal">isequal</a>, <a href="#XREFle">le</a>, <a href="#XREFge">ge</a>, <a href="#XREFgt">gt</a>, <a href="#XREFne">ne</a>, <a href="#XREFlt">lt</a>.
</p></dd></dl>
<a name="index-_003e_003d-1"></a>
<a name="XREFge"></a><dl>
<dt><a name="index-ge"></a>: <em></em> <strong>ge</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>This function is equivalent to <code><var>x</var> >= <var>y</var></code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFle">le</a>, <a href="#XREFeq">eq</a>, <a href="#XREFgt">gt</a>, <a href="#XREFne">ne</a>, <a href="#XREFlt">lt</a>.
</p></dd></dl>
<a name="index-_003e-1"></a>
<a name="XREFgt"></a><dl>
<dt><a name="index-gt"></a>: <em></em> <strong>gt</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>This function is equivalent to <code><var>x</var> > <var>y</var></code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFle">le</a>, <a href="#XREFeq">eq</a>, <a href="#XREFge">ge</a>, <a href="#XREFne">ne</a>, <a href="#XREFlt">lt</a>.
</p></dd></dl>
<a name="XREFisequal"></a><dl>
<dt><a name="index-isequal"></a>: <em></em> <strong>isequal</strong> <em>(<var>x1</var>, <var>x2</var>, …)</em></dt>
<dd><p>Return true if all of <var>x1</var>, <var>x2</var>, … are equal.
</p>
<p><strong>See also:</strong> <a href="#XREFisequaln">isequaln</a>.
</p></dd></dl>
<a name="XREFisequaln"></a><dl>
<dt><a name="index-isequaln"></a>: <em></em> <strong>isequaln</strong> <em>(<var>x1</var>, <var>x2</var>, …)</em></dt>
<dd><p>Return true if all of <var>x1</var>, <var>x2</var>, … are equal under the
additional assumption that NaN == NaN (no comparison of NaN placeholders
in dataset).
</p>
<p><strong>See also:</strong> <a href="#XREFisequal">isequal</a>.
</p></dd></dl>
<a name="index-_003c_003d-1"></a>
<a name="XREFle"></a><dl>
<dt><a name="index-le"></a>: <em></em> <strong>le</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>This function is equivalent to <code><var>x</var> <= <var>y</var></code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFeq">eq</a>, <a href="#XREFge">ge</a>, <a href="#XREFgt">gt</a>, <a href="#XREFne">ne</a>, <a href="#XREFlt">lt</a>.
</p></dd></dl>
<a name="index-_003c-1"></a>
<a name="XREFlt"></a><dl>
<dt><a name="index-lt"></a>: <em></em> <strong>lt</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>This function is equivalent to <code><var>x</var> < <var>y</var></code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFle">le</a>, <a href="#XREFeq">eq</a>, <a href="#XREFge">ge</a>, <a href="#XREFgt">gt</a>, <a href="#XREFne">ne</a>.
</p></dd></dl>
<a name="index-_0021_003d-1"></a>
<a name="index-_007e_003d-1"></a>
<a name="XREFne"></a><dl>
<dt><a name="index-ne"></a>: <em></em> <strong>ne</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>Return true if the two inputs are not equal.
</p>
<p>This function is equivalent to <code><var>x</var> != <var>y</var></code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFeq">eq</a>, <a href="#XREFisequal">isequal</a>, <a href="#XREFle">le</a>, <a href="#XREFge">ge</a>, <a href="#XREFlt">lt</a>.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Boolean-Expressions.html#Boolean-Expressions" accesskey="n" rel="next">Boolean Expressions</a>, Previous: <a href="Arithmetic-Ops.html#Arithmetic-Ops" accesskey="p" rel="prev">Arithmetic Ops</a>, Up: <a href="Expressions.html#Expressions" accesskey="u" rel="up">Expressions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|