<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Numbers on Shai Asher</title><link>https://slow-is-smooth.io/tags/numbers/</link><description>Recent content in Numbers on Shai Asher</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 16 Jun 2019 09:00:00 +0300</lastBuildDate><atom:link href="https://slow-is-smooth.io/tags/numbers/index.xml" rel="self" type="application/rss+xml"/><item><title>Numbers Are C Numbers Until They Aren't</title><link>https://slow-is-smooth.io/blog/numbers-are-c-numbers-until-they-arent/</link><pubDate>Sun, 16 Jun 2019 09:00:00 +0300</pubDate><guid>https://slow-is-smooth.io/blog/numbers-are-c-numbers-until-they-arent/</guid><description>&lt;p&gt;In Python, &lt;code&gt;2**62 * 4&lt;/code&gt; is 18446744073709551616. In a NumPy array of 64-bit integers it is 0, and&#10;NumPy 1.16 doesn&amp;rsquo;t say a word. Multiply the same value as a single NumPy scalar and you get a&#10;warning and the same 0. Python&amp;rsquo;s integers have no fixed size, but almost every library that makes&#10;Python fast stores numbers as C integers and C doubles, and at that boundary Python&amp;rsquo;s arithmetic&#10;quietly becomes C&amp;rsquo;s. CPython itself sits on both sides: its integers are arbitrary-precision, and its&#10;fastest paths are the ones that can do the work in a C &lt;code&gt;long&lt;/code&gt; or &lt;code&gt;double&lt;/code&gt; and never build a Python&#10;object at all.&lt;/p&gt;</description></item></channel></rss>