Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 223

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="expressions" page="arithmetic" subpage="multiplication"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Multiplication and division</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Multiplication and division"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Multiplication and division</h1>
      <p>The operator <code>*</code> multiplies two numbers. If the operands are of different types, one
of them is promoted to the type of the other (for example, an integer is promoted to a decimal, a
decimal to a double). The result is the same type as the operands after promotion.</p>
      <p>The operator <code>div</code> divides two numbers. Dividing two integers produces a double; in other
cases the result is the same type as the operands, after promotion. In the case of decimal division,
the precision is the sum of the precisions of the two operands, plus six.</p>
      <p>The operator <code>idiv</code> performs integer division. For example, the result of
<code>10 idiv 3</code> is <code>3</code>.</p>
      <p>The <code>mod</code> operator returns the modulus (or remainder) after division. See the XPath 2.0
specification for details of the way that negative numbers are handled.</p>
      <p>The operators <code>*</code> and <code>div</code> may also be used to multiply or divide
a duration by a number. For example, <code>fn:dayTimeDuration('PT12H') * 4</code> returns the duration
two days.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="addition.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>