<?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="addition"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Addition and subtraction</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Addition and subtraction"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Addition and subtraction</h1>
      <p>The operators <code>+</code> and <code>-</code> perform addition and subtraction of numbers,
in the usual way. If the operands are of different types, one of them is promoted, and the result
is the same type as the operands after promotion. For example, adding two integers produces
an integer; adding an integer to a double produces a double.</p>
      <p>Note that the <code>-</code> operator may need to be preceded by a space to prevent it being
parsed as part of the preceding name.</p>
      <p>XPath 2.0 also allows these operators to be used for adding durations to durations or to 
dates and times.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="../range.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>