MOD/de

From MCS Wiki AVR
< MOD(Difference between revisions)
Jump to: navigation, search
m (1 revision)
(Example)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span> =
+
= <span class="f_Header">Funktion</span> =
  
Calculates the remainder of a division.
+
Berechnet den Rest einer Division.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 15: Line 15:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
{| width="597" cellspacing="0" cellpadding="1" border="1" style="border: 1px solid rgb(0, 0, 0); border-spacing: 0px;"
 
{| width="597" cellspacing="0" cellpadding="1" border="1" style="border: 1px solid rgb(0, 0, 0); border-spacing: 0px;"
Line 23: Line 23:
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
Variable that will be assigned with the modules of var2 and var3.
+
Variable, der Ergebnis zugewiesen wird.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
Line 30: Line 30:
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
A numeric variable to take the modules from
+
Numerische Variable von der der Modulo berechnet werden soll
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
Line 37: Line 37:
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
The modulus
+
Teiler
  
 
|}
 
|}
Line 43: Line 43:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
The MOD operation is similar to the division operation(/). But while a division returns the number of times a number can be divided, the MOD returns the remainder.
+
Die MOD-Operation ist ähnlich wie die Division (/). Während allerdings die Division das Divisionsergebnis zurückgibt gibt MOD den Rest der Division zurück.
  
 
&nbsp;
 
&nbsp;
  
For example&nbsp;: 21 MOD 3 will result in 0 since 7x3=21. There will be no remainder.
+
Zum Beispiel: 21 MOD 3 ergibt 0 weil 7x3=21. Es gibt keinen Rest.
  
But 22 MOD 3 will result in 1 since 22-(7x3)=1
+
Aber 22 MOD 3 ergibt 1 weil 22-(7x3)=1
  
 
&nbsp;
 
&nbsp;
  
In BASCOM, the variable you assign determines which kind of math will be used. When you have 2 word variables you want to get the modulus from, you have to assign a word variable too.
+
In BASCOM bestimmt die Variable, der etwas zugewiesen wird die Berechnungsart. Wenn man zwei Word-Zahlen für MOD hat dann muss man auch einer Word-Variablen zuweisen.
  
When you assign a byte, byte math will be used.
+
Wenn einer Byte-Variablen zugewiesen wird dann wird Byte-Arithmetik benutzt.
  
 
&nbsp;
 
&nbsp;
Line 63: Line 63:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">See also</span> =
+
= <span class="f_Header">Siehe auch</span> =
  
 
[[Language Fundamentals|Language Fundamentals]]
 
[[Language Fundamentals|Language Fundamentals]]
Line 71: Line 71:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Example</span> =
+
= <span class="f_Header">Beispiel</span> =
  
 
<br/><source lang="bascomavr">
 
<br/><source lang="bascomavr">
Line 77: Line 77:
 
For L = 1 To 1000
 
For L = 1 To 1000
 
  L2 = L Mod 100
 
  L2 = L Mod 100
  If L2 = 0 Then ' multiple of 100
+
  If L2 = 0 Then ' Vielfaches von 100
 
  Print L
 
  Print L
 
  End If
 
  End If

Latest revision as of 01:49, 10 March 2013

Contents

Funktion

Berechnet den Rest einer Division.

 

 

Syntax

var1 = var2 MOD var3

 

 

Anmerkungen

var1

Variable, der Ergebnis zugewiesen wird.

var2

Numerische Variable von der der Modulo berechnet werden soll

var3

Teiler

 

Die MOD-Operation ist ähnlich wie die Division (/). Während allerdings die Division das Divisionsergebnis zurückgibt gibt MOD den Rest der Division zurück.

 

Zum Beispiel: 21 MOD 3 ergibt 0 weil 7x3=21. Es gibt keinen Rest.

Aber 22 MOD 3 ergibt 1 weil 22-(7x3)=1

 

In BASCOM bestimmt die Variable, der etwas zugewiesen wird die Berechnungsart. Wenn man zwei Word-Zahlen für MOD hat dann muss man auch einer Word-Variablen zuweisen.

Wenn einer Byte-Variablen zugewiesen wird dann wird Byte-Arithmetik benutzt.

 

 

 

Siehe auch

Language Fundamentals

 

 

Beispiel


Dim L As Long , L2 As Long
For L = 1 To 1000
 L2 = L Mod 100
 If L2 = 0 Then ' Vielfaches von 100
 Print L
 End If
Next

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language