<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Developer Day &#187; data-types</title>
	<atom:link href="http://www.thedeveloperday.com/tag/data-types/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedeveloperday.com</link>
	<description>Staying Curious</description>
	<lastBuildDate>Tue, 27 Jul 2010 17:33:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Common wrong Data Types compilation</title>
		<link>http://www.thedeveloperday.com/common-wrong-data-types-compilation/</link>
		<comments>http://www.thedeveloperday.com/common-wrong-data-types-compilation/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 17:45:31 +0000</pubDate>
		<dc:creator>Žilvinas Šaltys</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[data-types]]></category>

		<guid isPermaLink="false">http://www.thedeveloperday.com/common-wrong-data-types-compilation/</guid>
		<description><![CDATA[Found some nice MySQL data types tips how to create a database schema. Valuable information for intermediate and begginer developers to avoid the common database schema design pitfalls.]]></description>
			<content:encoded><![CDATA[<p>Found some nice <a title="mysql data types tips" href="http://code.openark.org/blog/?p=85">MySQL data types</a> tips how to create a database schema. Valuable information for intermediate and begginer developers to avoid the common database schema design pitfalls.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloperday.com/common-wrong-data-types-compilation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lost PHP float precision</title>
		<link>http://www.thedeveloperday.com/php-float-precision/</link>
		<comments>http://www.thedeveloperday.com/php-float-precision/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 10:18:46 +0000</pubDate>
		<dc:creator>Žilvinas Šaltys</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[data-types]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[precision]]></category>

		<guid isPermaLink="false">http://www.thedeveloperday.com/php-float-precision/</guid>
		<description><![CDATA[I was preparing for the Zend certificate exam and while reading the first pages of the Zend study guide I found some interesting things. Here&#8217;s a simple snippet of PHP code: echo (int) ( (0.1+0.7) * 10 ); What do you think the output would be? Surprisingly it&#8217;s 7. Internally in PHP it&#8217;s stored as 7.999999. [...]]]></description>
			<content:encoded><![CDATA[<p>I was preparing for the <a title="Zend PHP certificate" href="http://www.zend.com/en/services/certification/" target="_blank">Zend certificate exam</a> and while reading the first pages of the Zend study guide I found some interesting things. Here&#8217;s a simple snippet of <a href="http://www.php.net/">PHP</a> code:</p>
<pre name="code" class="php:nogutter">echo (int) ( (0.1+0.7) * 10 );</pre>
<p>What do you think the output would be? Surprisingly it&#8217;s 7. Internally in PHP it&#8217;s stored as 7.999999. Gladly this problem is described in PHP manual about <a title="PHP float precision warning" href="http://lt.php.net/manual/en/language.types.float.php#warn.float-precision" target="_blank">float precision</a>.</p>
<p>And sadly .. How many developers starting to develop PHP applications read about integers and float? When I started with PHP I thought to myself.. Hey it&#8217;s there. It&#8217;s simple and it works. What could be wrong with it? And after a while you wake up developing so called &#8220;enterprise applications&#8221; and you might start banging your head to the wall when you find out your reports are not so accurate as you thought <img src='http://www.thedeveloperday.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Probably not many developers make their priority to read about integers and floats?</p>
<p>Turns out this is a usual thing. A quote from PHP.net manual:</p>
<p><code>"<em>It is quite usual that simple decimal fractions like 0.1 or 0.7 cannot be converted into their internal binary counterparts without a little loss of precision.</em>"</code></p>
<p>PHP.net manual suggests developers should use <a title="php bcmath extension" href="http://lt.php.net/manual/en/ref.bc.php" target="_blank">bcmath extension</a> if higher precision is needed. Not only you can not cast floats to integers but you have to be careful comparing floats.</p>
<p>You might never run into this problem. But when you do it may come as an unpleasant surprise trying to find where is that single penny lost..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloperday.com/php-float-precision/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
