<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="_c74_vig.xsl" type="text/xsl"?>
<vignette name="Gen Common Operators" order="3" package="Gen" rankfactor="3">
  <h1>
	Gen Common Operators
</h1>
  <p>
			The following Gen operators are common to all
			of Max's Gen family of objects. They can be used as operators in the
      <o>gen</o>,
			<o>gen~</o>
			,
			<o>jit.gen</o>
			,
			<o>jit.pix</o>
			, and
			<o>jit.gl.pix</o>
			objects.
		</p>
  <!--Begin Gen Operators-->
  <h2>
	Comparison
 </h2>
  <ul>
    <li><link name="gen_common_neqp" type="genrefpage">!=p</link>, <link name="gen_common_neqp" type="genrefpage">neqp</link> :
<span name="common_neqp">Returns in1 if it does not equal in2, else returns zero.  Equivalent to in1*(in1 != in2).</span>
</li>
    <li><link name="gen_common_gt" type="genrefpage">&gt;</link>, <link name="gen_common_gt" type="genrefpage">gt</link> :
<span name="common_gt">Returns 1 if in1 is greater than in2, else returns zero.</span>
</li>
    <li><link name="gen_common_eq" type="genrefpage">==</link>, <link name="gen_common_eq" type="genrefpage">eq</link> :
<span name="common_eq">Returns 1 if in1 equals in2, else returns zero.</span>
</li>
    <li><link name="gen_common_eqp" type="genrefpage">==p</link>, <link name="gen_common_eqp" type="genrefpage">eqp</link> :
<span name="common_eqp">Returns in1 if it equals in2, else returns zero.  Equivalent to in1*(in1 == in2).</span>
</li>
    <li><link name="gen_common_gte" type="genrefpage">&gt;=</link>, <link name="gen_common_gte" type="genrefpage">gte</link> :
<span name="common_gte">Returns 1 if in1 is equal to or greater than in2, else returns zero.</span>
</li>
    <li><link name="gen_common_gtep" type="genrefpage">&gt;=p</link>, <link name="gen_common_gtep" type="genrefpage">gtep</link> :
<span name="common_gtep">Returns in1 if in1 is equal to or greater than in2, else returns zero.  Equivalent to in1*(in1 &gt;= in2).</span>
</li>
    <li><link name="gen_common_gtp" type="genrefpage">&gt;p</link>, <link name="gen_common_gtp" type="genrefpage">gtp</link> :
<span name="common_gtp">Returns in1 if in1 is greater than in2, else returns zero.  Equivalent to in1*(in1 &gt; in2).</span>
</li>
    <li><link name="gen_common_lt" type="genrefpage">&lt;</link>, <link name="gen_common_lt" type="genrefpage">lt</link> :
<span name="common_lt">Returns 1 if in1 is less than than in2, else returns zero.</span>
</li>
    <li><link name="gen_common_lte" type="genrefpage">&lt;=</link>, <link name="gen_common_lte" type="genrefpage">lte</link> :
<span name="common_lte">Returns 1 if in1 is equal to or less than in2, else returns zero.</span>
</li>
    <li><link name="gen_common_ltep" type="genrefpage">&lt;=p</link>, <link name="gen_common_ltep" type="genrefpage">ltep</link> :
<span name="common_ltep">Returns in1 if in1 is equal to or less than in2, else returns zero.  Equivalent to in1*(in1 &lt;= in2).</span>
</li>
    <li><link name="gen_common_ltp" type="genrefpage">&lt;p</link>, <link name="gen_common_ltp" type="genrefpage">ltp</link> :
<span name="common_ltp">Returns in1 if in1 is less than in2, else returns zero.  Equivalent to in1*(in1 &lt; in2).</span>
</li>
    <li><link name="gen_common_max" type="genrefpage">max</link>, <link name="gen_common_max" type="genrefpage">maximum</link> :
<span name="common_max">The maximum of the inputs</span>
</li>
    <li><link name="gen_common_min" type="genrefpage">min</link>, <link name="gen_common_min" type="genrefpage">minimum</link> :
<span name="common_min">The minimum of the inputs</span>
</li>
    <li><link name="gen_common_neq" type="genrefpage">!=</link>, <link name="gen_common_neq" type="genrefpage">neq</link> :
<span name="common_neq">Returns 1 if in1 does not equal in2, else returns zero.</span>
</li>
    <li><link name="gen_common_step" type="genrefpage">step</link> :
<span name="common_step">Akin to the GLSL step operator: 0 is returned if in1 &lt; in2, and 1 is returned otherwise.</span>
</li>
  </ul>
  <h2>
	Constant
 </h2>
  <ul>
    <li><link name="gen_common_constant" type="genrefpage">constant</link> :
<span name="common_constant">A constant value</span>
</li>
    <li><link name="gen_common_degtorad" type="genrefpage">degtorad</link>, <link name="gen_common_degtorad" type="genrefpage">DEGTORAD</link> :
<span name="common_degtorad">A constant value</span>
</li>
    <li><link name="gen_common_e" type="genrefpage">e</link>, <link name="gen_common_e" type="genrefpage">E</link> :
<span name="common_e">A constant value</span>
</li>
    <li><link name="gen_common_float" type="genrefpage">f</link>, <link name="gen_common_float" type="genrefpage">float</link> :
<span name="common_float">Either outputs a constant float or converts its input value to a float</span>
</li>
    <li><link name="gen_common_halfpi" type="genrefpage">halfpi</link>, <link name="gen_common_float" type="genrefpage">HALFPI</link> :
<span name="common_halfpi">A constant value</span>
</li>
    <li><link name="gen_common_int" type="genrefpage">i</link>, <link name="gen_common_int" type="genrefpage">int</link> :
<span name="common_int">Either outputs a constant integer or converts its input value to an integer.</span>
</li>
    <li><link name="gen_common_invpi" type="genrefpage">invpi</link>, <link name="gen_common_invpi" type="genrefpage">INVPI</link> :
<span name="common_invpi">A constant value</span>
</li>
    <li><link name="gen_common_ln10" type="genrefpage">ln10</link>, <link name="gen_common_ln10" type="genrefpage">LN10</link> :
<span name="common_ln10">A constant value</span>
</li>
    <li><link name="gen_common_ln2" type="genrefpage">ln2</link>, <link name="gen_common_ln2" type="genrefpage">LN2</link> :
<span name="common_ln2">A constant value</span>
</li>
    <li><link name="gen_common_log10e" type="genrefpage">log10e</link>, <link name="gen_common_log10e" type="genrefpage">LOG10E</link> :
<span name="common_log10e">A constant value</span>
</li>
    <li><link name="gen_common_log2e" type="genrefpage">log2e</link>, <link name="gen_common_log2e" type="genrefpage">LOG2E</link> :
<span name="common_log2e">A constant value</span>
</li>
    <li><link name="gen_common_phi" type="genrefpage">PHI</link>, <link name="gen_common_phi" type="genrefpage">phi</link> :
		<span name="common_phi">A constant value</span>
	</li>
    <li><link name="gen_common_pi" type="genrefpage">pi</link>, <link name="gen_common_pi" type="genrefpage">PI</link> :
<span name="common_pi">A constant value</span>
</li>
    <li><link name="gen_common_radtodeg" type="genrefpage">radtodeg</link>, <link name="gen_common_radtodeg" type="genrefpage">RADTODEG</link> :
<span name="common_radtodeg">A constant value</span>
</li>
    <li><link name="gen_common_sqrt1_2" type="genrefpage">sqrt1_2</link>, <link name="gen_common_sqrt1_2" type="genrefpage">SQRT1_2</link> :
<span name="common_sqrt1_2">A constant value</span>
</li>
    <li><link name="gen_common_sqrt2" type="genrefpage">sqrt2</link>, <link name="gen_common_sqrt2" type="genrefpage">SQRT2</link> :
<span name="common_sqrt2">A constant value</span>
</li>
    <li><link name="gen_common_twopi" type="genrefpage">twopi</link>, <link name="gen_common_twopi" type="genrefpage">TWOPI</link> :
<span name="common_twopi">A constant value</span>
</li>
  </ul>
  <h2>
	Declare
 </h2>
  <ul>
    <li><link name="gen_common_param" type="genrefpage">param</link>, <link name="gen_common_param" type="genrefpage">Param</link> :
<span name="common_param">Named parameters can be modified from outside the gen patcher. The first argument specifies the name of the parameter, the second argument the initial value.</span>
</li>
  </ul>
  <h2>
	Expression
 </h2>
  <ul>
    <li><link name="gen_common_expr" type="genrefpage">expr</link> :
<span name="common_expr">Evaluates GenExpr code.  Standard mathematical operators (+, -, *, / etc.) and gen patcher operators can be used. See the GenExpr documentation for more detail.</span>
</li>
  </ul>
  <h2>
	Ignore
 </h2>
  <ul>
    <li><link name="gen_common_pass" type="genrefpage">pass</link> :
		<span name="common_pass">Passes the value through unchanged.</span>
	</li>
  </ul>
  <h2>
	Input-output
 </h2>
  <ul>
    <li><link name="gen_common_in" type="genrefpage">in</link> :
<span name="common_in">Defines an input for a gen patcher.</span>
</li>
    <li><link name="gen_common_out" type="genrefpage">out</link> :
<span name="common_out">Send output from a gen patcher</span>
</li>
  </ul>
  <h2>
	Logic
 </h2>
  <ul>
    <li><link name="gen_common_not" type="genrefpage">!</link>, <link name="gen_common_not" type="genrefpage">not</link> :
<span name="common_not">An input value of zero returns 1, any other value returns zero.</span>
</li>
    <li><link name="gen_common_and" type="genrefpage">&amp;&amp;</link>, <link name="gen_common_and" type="genrefpage">and</link> :
<span name="common_and">Returns 1 if both in1 and in2 are nonzero.</span>
</li>
    <li><link name="gen_common_bool" type="genrefpage">bool</link> :
<span name="common_bool">Converts any nonzero value to 1 while zero passes through.</span>
</li>
    <li><link name="gen_common_or" type="genrefpage">or</link>, <link name="gen_common_or" type="genrefpage">||</link> :
<span name="common_or">Returns 1 if either in1 or in2 are nonzero.</span>
</li>
    <li><link name="gen_common_xor" type="genrefpage">^^</link>, <link name="gen_common_xor" type="genrefpage">xor</link> :
<span name="common_xor">Returns 1 if one of in1 and in2 are nonzero, but not both.</span>
</li>
  </ul>
  <h2>
	Math
 </h2>
  <ul>
    <li><link name="gen_common_rmod" type="genrefpage">!%</link>, <link name="gen_common_rmod" type="genrefpage">rmod</link> :
<span name="common_rmod">Reverse modulo (remainder of second input / first input)</span>
</li>
    <li><link name="gen_common_rsub" type="genrefpage">!-</link>, <link name="gen_common_rsub" type="genrefpage">rsub</link> :
<span name="common_rsub">Reverse subtraction (subtract first input from second)</span>
</li>
    <li><link name="gen_common_mod" type="genrefpage">%</link>, <link name="gen_common_mod" type="genrefpage">mod</link> :
<span name="common_mod">Modulo inputs (remainder of first input / second input)</span>
</li>
    <li><link name="gen_common_add" type="genrefpage">+</link>, <link name="gen_common_add" type="genrefpage">add</link> :
<span name="common_add">Add inputs</span>
</li>
    <li><link name="gen_common_sub" type="genrefpage">-</link>, <link name="gen_common_sub" type="genrefpage">sub</link> :
<span name="common_sub">Subtract inputs</span>
</li>
    <li><link name="gen_common_div" type="genrefpage">/</link>, <link name="gen_common_div" type="genrefpage">div</link> :
<span name="common_div">Divide inputs</span>
</li>
    <li><link name="gen_common_absdiff" type="genrefpage">absdiff</link> :
<span name="common_absdiff">Compute the absolute difference between two inputs using the equation abs(in1-in2).</span>
</li>
    <li><link name="gen_common_cartopol" type="genrefpage">cartopol</link> :
<span name="common_cartopol">Convert Cartesian values to polar format. Angles are in radians.</span>
</li>
    <li><link name="gen_common_mul" type="genrefpage">*</link>, <link name="gen_common_mul" type="genrefpage">mul</link> :
<span name="common_mul">Multiply inputs</span>
</li>
    <li><link name="gen_common_neg" type="genrefpage">neg</link> :
<span name="common_neg">Negate input</span>
</li>
    <li><link name="gen_common_poltocar" type="genrefpage">poltocar</link> :
<span name="common_poltocar">Convert polar values to Cartesian format. Angles are in radians.</span>
</li>
    <li><link name="gen_common_rdiv" type="genrefpage">!/</link>, <link name="gen_common_rdiv" type="genrefpage">rdiv</link> :
<span name="common_rdiv">Reverse division (divide second input by first)</span>
</li>
  </ul>
  <h2>
	Numeric
 </h2>
  <ul>
    <li><link name="gen_common_abs" type="genrefpage">abs</link> :
<span name="common_abs">Negative values will be converted to positive counterparts.</span>
</li>
    <li><link name="gen_common_ceil" type="genrefpage">ceil</link> :
<span name="common_ceil">Round the value up to the next higher integer</span>
</li>
    <li><link name="gen_common_floor" type="genrefpage">floor</link>, <link name="gen_common_trunc" type="genrefpage">trunc</link> :
<span name="common_floor">Round the value down to the next lower integer (toward negative infinity)</span>
</li>
    <li><link name="gen_common_fract" type="genrefpage">fract</link> :
<span name="common_fract">Return only the fractional component</span>
</li>
    <li><link name="gen_common_sign" type="genrefpage">sign</link> :
<span name="common_sign">Positive input returns 1, negative input returns -1, zero returns itself.</span>
</li>
    <li><link name="gen_common_trunc" type="genrefpage">trunc</link> :
		<span name="common_trunc">Round the value down to the next smaller integer (toward zero)</span>
	</li>
  </ul>
  <h2>
	Powers
 </h2>
  <ul>
    <li><link name="gen_common_exp" type="genrefpage">exp</link> :
<span name="common_exp">Raise the mathematical value e to a power</span>
</li>
    <li><link name="gen_common_exp2" type="genrefpage">exp2</link> :
<span name="common_exp2">Raise 2 to a power</span>
</li>
    <li><link name="gen_common_fastexp" type="genrefpage">fastexp</link> :
<span name="common_fastexp">Approximated e to a power</span>
</li>
    <li><link name="gen_common_fastpow" type="genrefpage">fastpow</link> :
<span name="common_fastpow">Approximated in1 to the power of in2</span>
</li>
    <li><link name="gen_common_ln" type="genrefpage">ln</link>, <link name="gen_common_log" type="genrefpage">log</link> :
<span name="common_ln">The natural logarithm</span>
</li>
    <li><link name="gen_common_log10" type="genrefpage">log10</link> :
<span name="common_log10">The logarithm base 10 of the input</span>
</li>
    <li><link name="gen_common_log2" type="genrefpage">log2</link> :
<span name="common_log2">The logarithm base 2 of the input</span>
</li>
    <li><link name="gen_common_pow" type="genrefpage">pow</link> :
<span name="common_pow">Raise in1 to the power of in2</span>
</li>
    <li><link name="gen_common_sqrt" type="genrefpage">sqrt</link> :
<span name="common_sqrt">The square root of the input</span>
</li>
  </ul>
  <h2>
	Range
 </h2>
  <ul>
    <li><link name="gen_common_clamp" type="genrefpage">clamp</link>, <link name="gen_common_clip" type="genrefpage">clip</link> :
<span name="common_clamp">Clamps the input value between specified min and max. Ranges are inclusive (both min and max values may be output)</span>
</li>
    <li><link name="gen_common_fold" type="genrefpage">fold</link> :
<span name="common_fold">Low and high values can be specified by arguments or by inlets. The default range is 0..1.</span>
</li>
    <li><link name="gen_common_scale" type="genrefpage">scale</link> :
<span name="common_scale">Similar to the Max scale and MSP scale~ objects. Inputs are: 1) value to scale, 2) input lower bound, 3), input upper bound, 4) output lower bound, 5) output upper bound, 6) exponential curve. Default lower and upper bounds are zero and one; default exponential curve is 1 (linear). No bound clamping is performed. The high and low values can be reversed for inverted mapping.</span>
</li>
    <li><link name="gen_common_wrap" type="genrefpage">wrap</link> :
<span name="common_wrap">Low and high values can be specified by arguments or by inlets. The default range is 0..1.</span>
</li>
  </ul>
  <h2>
	Route
 </h2>
  <ul>
    <li><link name="gen_common_switch" type="genrefpage">?</link>, <link name="gen_common_switch" type="genrefpage">switch</link> :
<span name="common_switch">Selects between the second and third inputs according to the boolean value of the first. If the first argument is true, the second argument will be output.  Otherwise, the third argument will be output.</span>
</li>
    <li><link name="gen_common_gate" type="genrefpage">gate</link> :
<span name="common_gate">Similar to the MSP gate~ object. It takes an argument for number of outputs (one is the default) and lets you choose which the incoming signal (at the right inlet) is sent to according to the (integer) value in the left inlet. A value of zero or less to the left inlet will choose no output; a value greater than the number of outlets will select the last outlet. Like gate~, un-selected outlets will send zero.</span>
</li>
    <li><link name="gen_common_mix" type="genrefpage">mix</link> :
<span name="common_mix">Mixes (interpolates) between inputs a and b according to the value of the third input t, using linear interpolation. The factor (t) should vary between 0 (for a) and 1 (for b). If one argument is given, it specifies the mix (interpolation) factor.</span>
</li>
    <li><link name="gen_common_receive" type="genrefpage">r</link>, <link name="gen_common_receive" type="genrefpage">receive</link> :
<span name="common_receive">Receive values from a named send. The send/receive pairs are only visible to each other within the same gen patcher.  They will not send across gen patchers or sub-patchers.</span>
</li>
    <li><link name="gen_common_send" type="genrefpage">s</link>, <link name="gen_common_send" type="genrefpage">send</link> :
<span name="common_send">Send values to a named receive. The send/receive pairs are only visible to each other within the same gen patcher.  They will not send across gen patchers or sub-patchers.</span>
</li>
    <li><link name="gen_common_selector" type="genrefpage">selector</link> :
<span name="common_selector">Similar to the MSP selector~ object. In a Gen patcher it takes an argument for number of choices (one is the default). In GenExpr, the number of choices is determined by the number of arguments. The first input lets you choose which of the remaining inputs is sent to the output. A value of zero or less to the first input will result in a zero signal at the output; a value greater than the number of choices will select the last input.</span>
</li>
    <li><link name="gen_common_smoothstep" type="genrefpage">smoothstep</link> :
<span name="common_smoothstep">Smoothstep is a scalar interpolation function commonly used in computer graphics. The function interpolates smoothly between two input values based on a third one that should be between the first two. The returned value is clamped between 0 and 1. The slope (i.e. derivative) of the smoothstep function starts at 0 and ends at 0.</span>
</li>
  </ul>
  <h2>
	Subpatcher
 </h2>
  <ul>
    <li><link name="gen_common_gen" type="genrefpage">gen</link> :
<span name="common_gen">Gen subpatcher or abstraction</span>
</li>
    <li><link name="gen_common_setparam" type="genrefpage">setparam</link> :
<span name="common_setparam">Set a param in a subpatcher from a parent patcher</span>
</li>
  </ul>
  <h2>
	Trigonometry
 </h2>
  <ul>
    <li><link name="gen_common_acos" type="genrefpage">acos</link> :
<span name="common_acos">The arc cosine of the input (returns radians)</span>
</li>
    <li><link name="gen_common_acosh" type="genrefpage">acosh</link> :
<span name="common_acosh">The inverse hyperbolic cosine of the input</span>
</li>
    <li><link name="gen_common_asin" type="genrefpage">asin</link> :
<span name="common_asin">The arc sine of the input (returns radians)</span>
</li>
    <li><link name="gen_common_asinh" type="genrefpage">asinh</link> :
<span name="common_asinh">The inverse hyperbolic sine of the input</span>
</li>
    <li><link name="gen_common_atan" type="genrefpage">atan</link> :
<span name="common_atan">The arc tangent of the input (returns radians)</span>
</li>
    <li><link name="gen_common_atan2" type="genrefpage">atan2</link> :
<span name="common_atan2">Returns the angle to the coordinate (x,y) in radians.</span>
</li>
    <li><link name="gen_common_atanh" type="genrefpage">atanh</link> :
<span name="common_atanh">The inverse hyperbolic tangent of the input</span>
</li>
    <li><link name="gen_common_cos" type="genrefpage">cos</link> :
<span name="common_cos">The cosine of the input (in radians)</span>
</li>
    <li><link name="gen_common_cosh" type="genrefpage">cosh</link> :
<span name="common_cosh">The hyperbolic cosine of the input</span>
</li>
    <li><link name="gen_common_degrees" type="genrefpage">degrees</link> :
<span name="common_degrees">convert radians to degrees</span>
</li>
    <li><link name="gen_common_fastcos" type="genrefpage">fastcos</link> :
<span name="common_fastcos">The approximated cosine of the input (in radians)</span>
</li>
    <li><link name="gen_common_fastsin" type="genrefpage">fastsin</link> :
<span name="common_fastsin">The approximated sine of the input (in radians)</span>
</li>
    <li><link name="gen_common_fasttan" type="genrefpage">fasttan</link> :
<span name="common_fasttan">The approximated tangent of the input (in radians)</span>
</li>
    <li><link name="gen_common_hypot" type="genrefpage">hypot</link> :
<span name="common_hypot">Returns the length of the vector to (in1, in2).</span>
</li>
    <li><link name="gen_common_radians" type="genrefpage">radians</link> :
<span name="common_radians">convert degrees to radians</span>
</li>
    <li><link name="gen_common_sin" type="genrefpage">sin</link> :
<span name="common_sin">The sine of the input (in radians)</span>
</li>
    <li><link name="gen_common_sinh" type="genrefpage">sinh</link> :
<span name="common_sinh">The hyperbolic sine of the input</span>
</li>
    <li><link name="gen_common_tan" type="genrefpage">tan</link> :
<span name="common_tan">The tangent of the input (in radians)</span>
</li>
    <li><link name="gen_common_tanh" type="genrefpage">tanh</link> :
<span name="common_tanh">The hyperbolic tangent of the input</span>
</li>
  </ul>
  <h2>
	Waveform
 </h2>
  <ul>
    <li><link name="gen_common_noise" type="genrefpage">noise</link> :
<span name="common_noise">A random number generator</span>
</li>
  </ul>
  <!--End Gen Operators-->
</vignette>
