<?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: PHP vs. BIGINT vs. float conversion caveat</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/</link>
	<description>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Skye</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-802521</link>
		<dc:creator>Skye</dc:creator>
		<pubDate>Thu, 24 Mar 2011 18:23:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-802521</guid>
		<description>Good post. Saved me some headaches with large ints using sprintf.</description>
		<content:encoded><![CDATA[<p>Good post. Saved me some headaches with large ints using sprintf.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SMAK</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-770118</link>
		<dc:creator>SMAK</dc:creator>
		<pubDate>Tue, 27 Jul 2010 08:25:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-770118</guid>
		<description>Awesome, thanks you soo much for this post.</description>
		<content:encoded><![CDATA[<p>Awesome, thanks you soo much for this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kr±g Starszoharcerski &#8220;Matrix&#8221; &#187; Blog Archive &#187; Jak nie nale¿y obs³ugiwaæ du¿ych liczb</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-233028</link>
		<dc:creator>Kr±g Starszoharcerski &#8220;Matrix&#8221; &#187; Blog Archive &#187; Jak nie nale¿y obs³ugiwaæ du¿ych liczb</dc:creator>
		<pubDate>Wed, 23 Jan 2008 07:42:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-233028</guid>
		<description>[...] przyk³ad - PHP. Ten akurat problem mnie za bardzo nie dotyczy³, ale to nie ¶wiadczy dobrze o PHP. Niestety, takich [...]</description>
		<content:encoded><![CDATA[<p>[...] przyk³ad &#8211; PHP. Ten akurat problem mnie za bardzo nie dotyczy³, ale to nie ¶wiadczy dobrze o PHP. Niestety, takich [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shodan</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230390</link>
		<dc:creator>shodan</dc:creator>
		<pubDate>Sat, 12 Jan 2008 13:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230390</guid>
		<description>Pierre,
thanks for the link, but the post point is a bit different: it&#039;s not about what you can use at this or that setup (there&#039;s plenty of extensions); it&#039;s only about the conversion issue you might run into.</description>
		<content:encoded><![CDATA[<p>Pierre,<br />
thanks for the link, but the post point is a bit different: it&#8217;s not about what you can use at this or that setup (there&#8217;s plenty of extensions); it&#8217;s only about the conversion issue you might run into.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pierre</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230300</link>
		<dc:creator>Pierre</dc:creator>
		<pubDate>Sat, 12 Jan 2008 09:24:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230300</guid>
		<description>Try http://pecl.php.net/package/big_int

It is relatively fast (given that you have a php function call on each op). About php and large integers, it never supported anything else than 32bits integer. Whether the integer was stored in the system default integer (64bits on amd64 for example) did not change this problem. It is annoying but once you know it :)

I have something about this topic on my todo, to expose the openssl math functions. They are not the faster on earth but they can then be available by default (as almost all setup has openssl installed).</description>
		<content:encoded><![CDATA[<p>Try <a href="http://pecl.php.net/package/big_int" rel="nofollow">http://pecl.php.net/package/big_int</a></p>
<p>It is relatively fast (given that you have a php function call on each op). About php and large integers, it never supported anything else than 32bits integer. Whether the integer was stored in the system default integer (64bits on amd64 for example) did not change this problem. It is annoying but once you know it <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I have something about this topic on my todo, to expose the openssl math functions. They are not the faster on earth but they can then be available by default (as almost all setup has openssl installed).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Windows Update &#187; Comment on PHP vs. BIGINT vs. float conversion caveat by Windows&#8230;</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230272</link>
		<dc:creator>Windows Update &#187; Comment on PHP vs. BIGINT vs. float conversion caveat by Windows&#8230;</dc:creator>
		<pubDate>Sat, 12 Jan 2008 07:35:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230272</guid>
		<description>[...] MySQL Performance Blog wrote an interesting post today on Comment on PHP vs. BIGINT vs. float conversion caveat by Windows&#8230;Here&#8217;s a quick excerpt[â€¦] MySQL Performance Blog wrote an interesting post today on PHP vs. BIGINT vs. float conversion caveatHereâ€™s a quick excerpt Sometimes you need&#8230; [...]</description>
		<content:encoded><![CDATA[<p>[...] MySQL Performance Blog wrote an interesting post today on Comment on PHP vs. BIGINT vs. float conversion caveat by Windows&#8230;Here&#8217;s a quick excerpt[â€¦] MySQL Performance Blog wrote an interesting post today on PHP vs. BIGINT vs. float conversion caveatHereâ€™s a quick excerpt Sometimes you need&#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Windows Update &#187; PHP vs. BIGINT vs. float conversion caveat</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230149</link>
		<dc:creator>Windows Update &#187; PHP vs. BIGINT vs. float conversion caveat</dc:creator>
		<pubDate>Sat, 12 Jan 2008 03:25:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230149</guid>
		<description>[...] MySQL Performance Blog wrote an interesting post today on PHP vs. BIGINT vs. float conversion caveatHere&#8217;s a quick excerpt Sometimes you need to work with big numbers in PHP (gulp). For example, sometimes 32-bit identifiers are not enough and you have to use BIGINT 64-bit ids; e.g. if you are encoding additional information like the server ID into high bits of the ID. I had already written about the mess that 64-bit integers are in PHP. But if the numbers you use do not cover 64-bit range fully, floats might save the day. The trick is that PHP floats are in fact doubles, i.e. double-precision 64-bit numbers. They [...]</description>
		<content:encoded><![CDATA[<p>[...] MySQL Performance Blog wrote an interesting post today on PHP vs. BIGINT vs. float conversion caveatHere&#8217;s a quick excerpt Sometimes you need to work with big numbers in PHP (gulp). For example, sometimes 32-bit identifiers are not enough and you have to use BIGINT 64-bit ids; e.g. if you are encoding additional information like the server ID into high bits of the ID. I had already written about the mess that 64-bit integers are in PHP. But if the numbers you use do not cover 64-bit range fully, floats might save the day. The trick is that PHP floats are in fact doubles, i.e. double-precision 64-bit numbers. They [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shodan</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230099</link>
		<dc:creator>shodan</dc:creator>
		<pubDate>Fri, 11 Jan 2008 23:37:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230099</guid>
		<description>Jakub,

you were right, it&#039;s the default settings of &quot;precision&quot; affecting this in ALL cases. Setting it to precision=16 (enough to hold 2^53 w/o sign) helps everywhere. The default values (both php.ini-dist and compiled-in) seems to vary but none of these reaches 16. I&#039;ll update the post.

It&#039;s not mentioned at php.net/float and the embedded description in php.ini-dist is, well, not quite clear (&quot;The number of significant digits displayed in floating point numbers&quot;). I believe it&#039;s kept at default 12 as most if not all sites.</description>
		<content:encoded><![CDATA[<p>Jakub,</p>
<p>you were right, it&#8217;s the default settings of &#8220;precision&#8221; affecting this in ALL cases. Setting it to precision=16 (enough to hold 2^53 w/o sign) helps everywhere. The default values (both php.ini-dist and compiled-in) seems to vary but none of these reaches 16. I&#8217;ll update the post.</p>
<p>It&#8217;s not mentioned at php.net/float and the embedded description in php.ini-dist is, well, not quite clear (&#8220;The number of significant digits displayed in floating point numbers&#8221;). I believe it&#8217;s kept at default 12 as most if not all sites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230096</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 11 Jan 2008 23:21:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230096</guid>
		<description>Antony,

Regarding other libraries to deal with big numbers in PHP they have one serious issue - they are rather slow.
Sometimes it does not matter but sometimes it does.</description>
		<content:encoded><![CDATA[<p>Antony,</p>
<p>Regarding other libraries to deal with big numbers in PHP they have one serious issue &#8211; they are rather slow.<br />
Sometimes it does not matter but sometimes it does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/comment-page-1/#comment-230094</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 11 Jan 2008 23:19:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/#comment-230094</guid>
		<description>Thanks Andrew I&#039;ve now modified the comment.</description>
		<content:encoded><![CDATA[<p>Thanks Andrew I&#8217;ve now modified the comment.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

