Last sync 2016.04.01
[deliverable/titan.core.git] / help / info / mod.html
CommitLineData
970ed795 1<!--
d44e3c4f 2 Copyright (c) 2000-2016 Ericsson Telecom AB
970ed795
EL
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/epl-v10.html
d44e3c4f 7
8 Contributors:
9 Baji, Laszlo
10 Balasko, Jeno
11 Farkas, Laszlo
12 Szabados, Kristof
13-->
970ed795
EL
14<html>
15<head>
16<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
17<meta http-equiv="Content-Language" content="en-us">
18<title>mod</title>
19</head>
20<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
21<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
22 <tr>
23 <td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td>
24 </tr>
25</table>
26<table border="0" align="right" cellpadding="0" cellspacing="0">
27 <tr>
28 <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
29 <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
30 <td><a href="mixed.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
31 <td><a href="modifies.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
32 </tr>
33</table>
34<p><br clear="all">
35</p>
36<hr>
37<h1>mod</h1>
38<hr align="left" width="75%">
39<p>The keyword <b><font face="Courier New">mod</font></b> belongs to the family of the arithmetic operators. It operates on two operands of <font face="Courier New"><b>integer</b></font> type and
40on its derivates. The operation x mod y computes the rest that remains from an integer division of x by y.&nbsp;</p>
41<ul>
42 <li>The result of the operation is <font face="Courier New"><b>integer</b></font>;</li>
43 <li>the operation is defined for non-zero operands only;</li>
44 <li>the result is always non-negative, see chapter 15.1 of the standard.</li>
45</ul>
46<p>Related keywords:</p>
47<ul>
48 <li><a href="rem.html"><b><font face="Courier New" color="#003258" size="4">rem</font></b></a></li>
49</ul>
50<hr align="left" width="50%">
51<div align="center">
52<center>
53<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
54 <tr>
55 <td width="100%">
56 <h3 align="center"><font face="Courier New" color="#003258" size="5"><b>mod</b></font></h3>
57 </td>
58 </tr>
59</table>
60</center>
61</div>
62<hr align="left" width="50%">
63<p>Example:
64<p><font face="Courier New">for (var integer j:=-3; j&lt;=3; j:= j+1) {<br>
65&nbsp&nbsp&nbsp;var integer vl_log := (j mod 3);<br>
66&nbsp&nbsp&nbsp;log (vl_log)<br>
67}</font> <br>
68<p>The log will contain the following integer values: 0 1 2 0 1 2 0.
69<hr align="left" width="25%">
70<hr align="left" width="25%">
71<p><a HREF="BNF.html#multiplyop">BNF definition</a> of <font face="Courier New">mod</font></p>
72</body>
73</html>
This page took 0.026573 seconds and 5 git commands to generate.