Navigation Menu

Skip to content

Commit

Permalink
Update information about 3/4 = 0 or not
Browse files Browse the repository at this point in the history
  • Loading branch information
bsherwood committed Jun 15, 2011
1 parent e868fa5 commit d97d7ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/visual/float.html
Expand Up @@ -98,7 +98,7 @@
<h1 class="Heading-1"> <font color="#0000A0">Floating Division</font></h1>
</div>
<div>
<p class="Normal"> By default, Python performs integer division with truncation,
<p class="Normal"> For versions of Python prior to 3.0, Python performs integer division with truncation,
so that 3/4 is 0, not 0.75. This is inconvenient when doing scientific computations,
and can lead to hard-to-find bugs in programs. You can write 3./4., which
is 0.75 by the rules of &quot;floating-point&quot; division. </p>
Expand All @@ -108,6 +108,7 @@ <h1 class="Heading-1"> <font color="#0000A0">Floating Division</font></h1>
<p class="program">from __future__ import division</p>
<p class="Normal">There are two underscores (&quot;_&quot; and &quot;_&quot;)
before &quot;future&quot; and two after. </p>
<p class="Normal">Starting with Python 3.0, 3/4 means 0.75 and <strong>from __future__ import division</strong> is no longer needed and is ignored. You may wish to include this statement, however, so that your program will run correctly on earlier versions of Python.</p>
<p class="Normal">The Visual module converts integers to floating-point numbers
for you when specifying attributes of objects:</p>
<div>
Expand Down

0 comments on commit d97d7ea

Please sign in to comment.