<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: IEEE floating point arithmetic in Python</title>
	<atom:link href="http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/</link>
	<description>The blog of John D. Cook</description>
	<lastBuildDate>Sat, 11 Feb 2012 01:10:06 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/comment-page-1/#comment-21529</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 22 Jul 2009 12:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2704#comment-21529</guid>
		<description>Thanks Mike. I left out a &quot;not.&quot; I corrected the post.</description>
		<content:encoded><![CDATA[<p>Thanks Mike. I left out a &#8220;not.&#8221; I corrected the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Swaim</title>
		<link>http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/comment-page-1/#comment-21527</link>
		<dc:creator>Mike Swaim</dc:creator>
		<pubDate>Wed, 22 Jul 2009 12:45:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2704#comment-21527</guid>
		<description>Did you mean to say that Python integers are the same as C ints, or that they aren&#039;t? It looks like you said that they are.</description>
		<content:encoded><![CDATA[<p>Did you mean to say that Python integers are the same as C ints, or that they aren&#8217;t? It looks like you said that they are.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paddy3118</title>
		<link>http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/comment-page-1/#comment-21496</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Tue, 21 Jul 2009 20:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2704#comment-21496</guid>
		<description>@David,
I think they have further blurred things in Python 3: ints are arbitrary precision, but, when possible, fixed precision calculations are done. They are trying to have a seemless transition between what were ints and what were longs in Python 2.x days.

- Paddy.</description>
		<content:encoded><![CDATA[<p>@David,<br />
I think they have further blurred things in Python 3: ints are arbitrary precision, but, when possible, fixed precision calculations are done. They are trying to have a seemless transition between what were ints and what were longs in Python 2.x days.</p>
<p>- Paddy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Warde-Farley</title>
		<link>http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/comment-page-1/#comment-21493</link>
		<dc:creator>David Warde-Farley</dc:creator>
		<pubDate>Tue, 21 Jul 2009 18:38:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2704#comment-21493</guid>
		<description>The situation is a little bit more complex: Python integers are not actually arbitrary precision in Python 2.x (unsure about 3.x), what &lt;em&gt;are&lt;/em&gt; arbitrary precision are longs, which sometimes result from integer operations (i.e. 2**400). You can tell the difference either by looking at what&#039;s returned by type() or by seeing an &#039;L&#039; at the end of its textual representation.  Replacing all integer arithmetic with arbitrary precision arithmetic in software would likely make a lot of things unbearably slow. The Python &#039;int&#039; type corresponds to C &#039;long&#039;, and Python &#039;long&#039; is the arbitrary precision type. NumPy also contains integer types that have a specific bit-width: int8, int16, int32, int64, which correspond to the C type. This can be pretty important if you&#039;re working with large files and don&#039;t want 4 or 8 bytes for every element when 1 or 2 would do.

Also, a neat feature of NumPy is that, with NumPy arrays and floating point scalar types (float32, float64, float128 as well as complex64, complex128 and complex256) is that you can control the effect of hitting division by zero, overflow, underflow or invalid ops (things that produce NaN); each of these errors can either be ignored, produce a warning, raise an exception, or call a user-specified function. Have a look at the documentation for numpy.seterr for the specifics.</description>
		<content:encoded><![CDATA[<p>The situation is a little bit more complex: Python integers are not actually arbitrary precision in Python 2.x (unsure about 3.x), what <em>are</em> arbitrary precision are longs, which sometimes result from integer operations (i.e. 2**400). You can tell the difference either by looking at what&#8217;s returned by type() or by seeing an &#8216;L&#8217; at the end of its textual representation.  Replacing all integer arithmetic with arbitrary precision arithmetic in software would likely make a lot of things unbearably slow. The Python &#8216;int&#8217; type corresponds to C &#8216;long&#8217;, and Python &#8216;long&#8217; is the arbitrary precision type. NumPy also contains integer types that have a specific bit-width: int8, int16, int32, int64, which correspond to the C type. This can be pretty important if you&#8217;re working with large files and don&#8217;t want 4 or 8 bytes for every element when 1 or 2 would do.</p>
<p>Also, a neat feature of NumPy is that, with NumPy arrays and floating point scalar types (float32, float64, float128 as well as complex64, complex128 and complex256) is that you can control the effect of hitting division by zero, overflow, underflow or invalid ops (things that produce NaN); each of these errors can either be ignored, produce a warning, raise an exception, or call a user-specified function. Have a look at the documentation for numpy.seterr for the specifics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paddy3118</title>
		<link>http://www.johndcook.com/blog/2009/07/21/ieee-arithmetic-python/comment-page-1/#comment-21491</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Tue, 21 Jul 2009 18:10:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2704#comment-21491</guid>
		<description>&quot;There are two kinds of exceptional floating point values: infinities and NaNs.&quot;
There is also the quirky plus and minus zero.

(In Python 2.6)
&lt;code&gt;
&gt;&gt;&gt; -0.
-0.0
&gt;&gt;&gt; +0.
0.0
&gt;&gt;&gt; +0. == -0.
True
&gt;&gt;&gt; +0. is -0.
False
&gt;&gt;&gt; +0. is +0.
True
&gt;&gt;&gt; -0. is -0.
True
&gt;&gt;&gt; -0. is +0.
False
&gt;&gt;&gt; 
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>&#8220;There are two kinds of exceptional floating point values: infinities and NaNs.&#8221;<br />
There is also the quirky plus and minus zero.</p>
<p>(In Python 2.6)<br />
<code><br />
&gt;&gt;&gt; -0.<br />
-0.0<br />
&gt;&gt;&gt; +0.<br />
0.0<br />
&gt;&gt;&gt; +0. == -0.<br />
True<br />
&gt;&gt;&gt; +0. is -0.<br />
False<br />
&gt;&gt;&gt; +0. is +0.<br />
True<br />
&gt;&gt;&gt; -0. is -0.<br />
True<br />
&gt;&gt;&gt; -0. is +0.<br />
False<br />
&gt;&gt;&gt;<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.319 seconds -->

