<?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"
	>
<channel>
	<title>Comments on: 2.5 &#8212; Floating point numbers</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/</link>
	<description></description>
	<pubDate>Thu, 24 Jul 2008 16:27:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Mitul Golakiya</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-19196</link>
		<dc:creator>Mitul Golakiya</dc:creator>
		<pubDate>Tue, 17 Jun 2008 13:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-19196</guid>
		<description>/* Program to know real value of fTotal */

#include &#60;iostream.h&#62;
#include &#60;conio.h&#62;

void main()
{
	clrscr();

	float fValue1 = 1.345f;
	float fValue2 = 1.123f;
	float fTotal = fValue1 + fValue2; // should be 2.468

	if (fTotal == 2.468)
	{
	    cout &#60;&#60; &#34;n fTotal is 2.468&#34;;
	}
	else
	{
	    cout &#60;&#60; &#34;n fTotal is not 2.468&#34;;
	}

	printf(&#34;n The real value of fTotal is %0.7f&#34;, fTotal);
	getch();
}

/* End of Pgram */</description>
		<content:encoded><![CDATA[<p>/* Program to know real value of fTotal */</p>
<p>#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;</p>
<p>void main()<br />
{<br />
	clrscr();</p>
<p>	float fValue1 = 1.345f;<br />
	float fValue2 = 1.123f;<br />
	float fTotal = fValue1 + fValue2; // should be 2.468</p>
<p>	if (fTotal == 2.468)<br />
	{<br />
	    cout &lt;&lt; &quot;n fTotal is 2.468&quot;;<br />
	}<br />
	else<br />
	{<br />
	    cout &lt;&lt; &quot;n fTotal is not 2.468&quot;;<br />
	}</p>
<p>	printf(&quot;n The real value of fTotal is %0.7f&quot;, fTotal);<br />
	getch();<br />
}</p>
<p>/* End of Pgram */</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitul Golakiya</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-19195</link>
		<dc:creator>Mitul Golakiya</dc:creator>
		<pubDate>Tue, 17 Jun 2008 13:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-19195</guid>
		<description>/* Program to know real value of fTotal */

#include &#60;iostream.h&#62;
#include &#60;conio.h&#62;

void main()
{
	clrscr();
	double fValue;

	float fValue1 = 1.345f;
	float fValue2 = 1.123f;
	float fTotal = fValue1 + fValue2; // should be 2.468

	if (fTotal == 2.468)
	{
	    cout &#60;&#60; &#34;n fTotal is 2.468&#34;;
	}
	else
	{
	    cout &#60;&#60; &#34;n fTotal is not 2.468&#34;;
	}

	printf(&#34;n The real value of fTotal is %0.7f&#34;, fTotal);
	getch();
}

/* End of Pgram */</description>
		<content:encoded><![CDATA[<p>/* Program to know real value of fTotal */</p>
<p>#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;</p>
<p>void main()<br />
{<br />
	clrscr();<br />
	double fValue;</p>
<p>	float fValue1 = 1.345f;<br />
	float fValue2 = 1.123f;<br />
	float fTotal = fValue1 + fValue2; // should be 2.468</p>
<p>	if (fTotal == 2.468)<br />
	{<br />
	    cout &lt;&lt; &quot;n fTotal is 2.468&quot;;<br />
	}<br />
	else<br />
	{<br />
	    cout &lt;&lt; &quot;n fTotal is not 2.468&quot;;<br />
	}</p>
<p>	printf(&quot;n The real value of fTotal is %0.7f&quot;, fTotal);<br />
	getch();<br />
}</p>
<p>/* End of Pgram */</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 2.4 &#8212; Integers</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-12631</link>
		<dc:creator>Learn C++ - &#187; 2.4 &#8212; Integers</dc:creator>
		<pubDate>Wed, 23 Apr 2008 02:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-12631</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; We apologize for the downtime &#124; Home &#124; 2.5 &#8212; Floating point numbers &#187;     Saturday, June 9th, 2007 at 11:47 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; We apologize for the downtime | Home | 2.5 &#8212; Floating point numbers &raquo;     Saturday, June 9th, 2007 at 11:47 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 2.6 &#8212; Boolean Values</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-12599</link>
		<dc:creator>Learn C++ - &#187; 2.6 &#8212; Boolean Values</dc:creator>
		<pubDate>Wed, 23 Apr 2008 01:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-12599</guid>
		<description>[...]  2.5 â€” Floating point numbers [...]</description>
		<content:encoded><![CDATA[<p>[...]  2.5 â€” Floating point numbers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-9750</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Mon, 17 Mar 2008 15:58:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-9750</guid>
		<description>You need to include iomanip.h to use setprecision() that way.

See &lt;a href="http://www.learncpp.com/cpp-tutorial/133-output-with-ostream-and-ios/" rel="nofollow"&gt;the lesson on ostream&lt;/a&gt; for more info about output manipulators and stuff.</description>
		<content:encoded><![CDATA[<p>You need to include iomanip.h to use setprecision() that way.</p>
<p>See <a href="http://www.learncpp.com/cpp-tutorial/133-output-with-ostream-and-ios/" rel="nofollow">the lesson on ostream</a> for more info about output manipulators and stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Masss</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-9705</link>
		<dc:creator>Masss</dc:creator>
		<pubDate>Mon, 17 Mar 2008 00:00:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-9705</guid>
		<description>Is there something wrong with my code?

The compiler brings up a problem with setprecision()..

&lt;pre&gt;
#include "stdafx.h"
#include &lt;iostream&gt;

int main()
{
	using namespace std;

	cout &lt;&lt; setprecision(16);
	float fValue;
	fValue = 1.3333333333333333f;
	cout &lt;&lt; fValue &lt;&lt; endl;
	
	cin.ignore(255, '/n');
	cin.get();
	return 0;
}
&lt;/pre&gt; 

Thanks</description>
		<content:encoded><![CDATA[<p>Is there something wrong with my code?</p>
<p>The compiler brings up a problem with setprecision()..</p>
<pre>
#include "stdafx.h"
#include <iostream>

int main()
{
	using namespace std;

	cout < < setprecision(16);
	float fValue;
	fValue = 1.3333333333333333f;
	cout << fValue << endl;

	cin.ignore(255, '/n');
	cin.get();
	return 0;
}
</pre>
<p>Thanks</iostream></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-7592</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sun, 10 Feb 2008 01:11:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-7592</guid>
		<description>By default, if you type a floating point value into C++ it's typed as a double.  Consequently, if you do something like this:

&lt;pre&gt;
float fValue = 4.53; // 4.53 is a double
&lt;/pre&gt;

You're assigning a double to a float, which loses precision, and the compiler will probably complain.

Putting an "f" after the value means that you intend that value to be a float, not a double.  Then when you do this:

&lt;pre&gt;
float fValue = 4.53f; // 4.53 is a float
&lt;/pre&gt;

You're assigning a float value to a float variable, which makes more sense.</description>
		<content:encoded><![CDATA[<p>By default, if you type a floating point value into C++ it&#8217;s typed as a double.  Consequently, if you do something like this:</p>
<pre>
float fValue = 4.53; // 4.53 is a double
</pre>
<p>You&#8217;re assigning a double to a float, which loses precision, and the compiler will probably complain.</p>
<p>Putting an &#8220;f&#8221; after the value means that you intend that value to be a float, not a double.  Then when you do this:</p>
<pre>
float fValue = 4.53f; // 4.53 is a float
</pre>
<p>You&#8217;re assigning a float value to a float variable, which makes more sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jefferson</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-7588</link>
		<dc:creator>Jefferson</dc:creator>
		<pubDate>Sun, 10 Feb 2008 00:13:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-7588</guid>
		<description>What do the f's after some of the float and double values mean?</description>
		<content:encoded><![CDATA[<p>What do the f&#8217;s after some of the float and double values mean?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: C++ Student</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-7105</link>
		<dc:creator>C++ Student</dc:creator>
		<pubDate>Sat, 02 Feb 2008 20:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-7105</guid>
		<description>It is far less confusing after reading this.  Thank you.  In class we covered this in about ten minutes and moved on to the next thing.

I've been to a few sites already trying to get a grasp on these (floats/doubles) and this summation really did the trick.

Thanks!</description>
		<content:encoded><![CDATA[<p>It is far less confusing after reading this.  Thank you.  In class we covered this in about ten minutes and moved on to the next thing.</p>
<p>I&#8217;ve been to a few sites already trying to get a grasp on these (floats/doubles) and this summation really did the trick.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Person In Need</title>
		<link>http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/#comment-5897</link>
		<dc:creator>Person In Need</dc:creator>
		<pubDate>Sat, 12 Jan 2008 05:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=46#comment-5897</guid>
		<description>wow.........to be honest this was extremely confusing man.......</description>
		<content:encoded><![CDATA[<p>wow&#8230;&#8230;&#8230;to be honest this was extremely confusing man&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
