Programmer Guide/SPU Reference/MOD: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
 
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====MOD====
Remainder of quotient of <var>A</var> and <var>B</var> (modulo).
 
==<code>[SPU MOD <var>A B</var> OUT <var>Y</var>]</code>==
=====Usage:=====
{|class="einrahmen"
 
!In !!Out !!Description
<code>MOD <var>a b</var></code>
 
=====Inputs:=====
 
{|
|-
|-
|a
|<var>A<sub>number</sub></var>, <var>B<sub>number</sub></var>
|number or vector
|<var>Y<sub>number</sub></var>
|<var>Y</var> = <var>A</var> % <var>B</var>
|-
|-
|b
|<var>A<sub>vector</sub></var>, <var>B<sub>number</sub></var>
|number or vector
|<var>Y<sub>vector</sub></var>
|}
|<var>Y</var>[i] = <var>A</var>[i] % <var>B</var>
 
=====Outputs:=====
 
{|
|-
|-
|<var>y</var>
|<var>A<sub>vector</sub></var>, <var>B<sub>vector</sub></var>  
|number or vector (same type as a)
|<var>Y<sub>vector</sub></var>
|<var>Y</var>[i] = <var>A</var>[i] % <var>B</var>[i]
|}
|}
with: 0 &le; i &lt; length of <var>A<sub>vector</sub></var>


=====Function:=====
note: if <var>B</var> (<var>B</var>[i]) equals 0, the output <var>Y</var> (<var>Y</var>[i]) is set to 0.
 
;See also:
Compute <var>a</var> modulo <var>b</var>.
<[[../#Signal Processing Atoms|SP-atoms]]>
 
<!-- AN, 2.5.2011 -->
if <var>a</var> and <var>b</var> are numbers: <var>y</var> = <var>a</var> mod <var>b</var>
 
if <var>a</var> is a vector and <var>b</var> a number: <var>y</var>[i] = <var>a</var>[i] mod <var>b</var>
 
if <var>a</var> and <var>b</var> are vectors: <var>y</var>[i] = <var>a</var>[i] mod <var>b</var>[i]
 
If the value of <var>b</var>|<var>b</var>[i] is zero, the result <var>y</var>|<var>y</var>[i] is also set to zero.

Latest revision as of 12:12, 2 May 2011

Remainder of quotient of A and B (modulo).

[SPU MOD A B OUT Y]

In Out Description
Anumber, Bnumber Ynumber Y = A % B
Avector, Bnumber Yvector Y[i] = A[i] % B
Avector, Bvector Yvector Y[i] = A[i] % B[i]

with: 0 ≤ i < length of Avector

note: if B (B[i]) equals 0, the output Y (Y[i]) is set to 0.

See also

<SP-atoms>

Navigation menu

Personal tools