Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / ref / integers.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="ref.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="ref.html" title='Python Reference Manual' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="floating.html" />
<link rel="prev" href="numbers.html" />
<link rel="parent" href="literals.html" />
<link rel="next" href="floating.html" />
<meta name='aesop' content='information' />
<title>2.4.4 Integer and long integer literals</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.4.3 Numeric literals"
href="numbers.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="2.4 Literals"
href="literals.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="2.4.5 Floating point literals"
href="floating.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Reference Manual</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="numbers.html">2.4.3 Numeric literals</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="literals.html">2.4 Literals</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="floating.html">2.4.5 Floating point literals</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION004440000000000000000"></A><A NAME="integers"></A>
<BR>
2.4.4 Integer and long integer literals
</H2>
<P>
Integer and long integer literals are described by the following
lexical definitions:
<P>
<dl><dd class="grammar">
<div class="productions">
<table>
<tr>
<td><a id='tok-longinteger' xml:id='tok-longinteger'>longinteger</a></td>
<td>::=</td>
<td><a class='grammartoken' href="integers.html#tok-integer">integer</a> ("l" | "L")</td></tr>
<tr>
<td><a id='tok-integer' xml:id='tok-integer'>integer</a></td>
<td>::=</td>
<td><a class='grammartoken' href="integers.html#tok-decimalinteger">decimalinteger</a> | <a class='grammartoken' href="integers.html#tok-octinteger">octinteger</a> | <a class='grammartoken' href="integers.html#tok-hexinteger">hexinteger</a></td></tr>
<tr>
<td><a id='tok-decimalinteger' xml:id='tok-decimalinteger'>decimalinteger</a></td>
<td>::=</td>
<td><a class='grammartoken' href="integers.html#tok-nonzerodigit">nonzerodigit</a> <a class='grammartoken' href="identifiers.html#tok-digit">digit</a>* | "0"</td></tr>
<tr>
<td><a id='tok-octinteger' xml:id='tok-octinteger'>octinteger</a></td>
<td>::=</td>
<td>"0" <a class='grammartoken' href="integers.html#tok-octdigit">octdigit</a>+</td></tr>
<tr>
<td><a id='tok-hexinteger' xml:id='tok-hexinteger'>hexinteger</a></td>
<td>::=</td>
<td>"0" ("x" | "X") <a class='grammartoken' href="integers.html#tok-hexdigit">hexdigit</a>+</td></tr>
<tr>
<td><a id='tok-nonzerodigit' xml:id='tok-nonzerodigit'>nonzerodigit</a></td>
<td>::=</td>
<td>"1"..."9"</td></tr>
<tr>
<td><a id='tok-octdigit' xml:id='tok-octdigit'>octdigit</a></td>
<td>::=</td>
<td>"0"..."7"</td></tr>
<tr>
<td><a id='tok-hexdigit' xml:id='tok-hexdigit'>hexdigit</a></td>
<td>::=</td>
<td><a class='grammartoken' href="identifiers.html#tok-digit">digit</a> | "a"..."f" | "A"..."F"</td></tr>
</table>
</div>
<a class="grammar-footer"
href="grammar.txt" type="text/plain"
>Download entire grammar as text.</a>
</dd></dl>
<P>
Although both lower case "<tt class="character">l</tt>" and upper case "<tt class="character">L</tt>" are
allowed as suffix for long integers, it is strongly recommended to always
use "<tt class="character">L</tt>", since the letter "<tt class="character">l</tt>" looks too much like the
digit "<tt class="character">1</tt>".
<P>
Plain integer literals that are above the largest representable plain
integer (e.g., 2147483647 when using 32-bit arithmetic) are accepted
as if they were long integers instead.<A NAME="tex2html1"
HREF="#foot461"><SUP>2.1</SUP></A> There is no limit for long integer
literals apart from what can be stored in available memory.
<P>
Some examples of plain integer literals (first row) and long integer
literals (second and third rows):
<P>
<div class="verbatim"><pre>
7 2147483647 0177
3L 79228162514264337593543950336L 0377L 0x100000000L
79228162514264337593543950336 0xdeadbeef
</pre></div>
<P>
<BR><HR><H4>Footnotes</H4>
<DL>
<DT><A NAME="foot461">... instead.</A><A
href="integers.html#tex2html1"><SUP>2.1</SUP></A></DT>
<DD>In versions of Python
prior to 2.4, octal and hexadecimal literals in the range just above
the largest representable plain integer but below the largest unsigned
32-bit number (on a machine using 32-bit arithmetic), 4294967296, were
taken as the negative plain integer obtained by subtracting 4294967296
from their unsigned value.
</DD>
</DL>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.4.3 Numeric literals"
href="numbers.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="2.4 Literals"
href="literals.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="2.4.5 Floating point literals"
href="floating.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Reference Manual</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="numbers.html">2.4.3 Numeric literals</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="literals.html">2.4 Literals</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="floating.html">2.4.5 Floating point literals</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>