<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>2 + 2 equals "Monday Evening"</title><link>http://blogs.msdn.com/b/powershell/archive/2007/01/09/2-2-equals-monday-evening.aspx</link><description>I wanted to follow up on Jeffrey's post and one of the comments. It has to do with this example: 
 PS&amp;gt; [int]1/2 0.5 
 The reason that we get a double rather than an int is because of precedence. The conversion has a higher precedence than the division</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: 2 + 2 equals "Monday Evening"</title><link>http://blogs.msdn.com/b/powershell/archive/2007/01/09/2-2-equals-monday-evening.aspx#1440380</link><pubDate>Wed, 10 Jan 2007 00:22:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1440380</guid><dc:creator>John</dc:creator><description>&lt;p&gt;I'm just guessing, but is it possibly when the types are incompatible that the first operand is used in this way?&lt;/p&gt;
&lt;p&gt;Internally, the + operator works as an overloaded function. &amp;nbsp;When you use + with strings, it concatenates. &amp;nbsp;When you use it with numeric types (floats, doubles and integers). &amp;nbsp;Because .NET has a + operator that can add floats to integers, it uses that, and returns whatever that returns.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1440380" width="1" height="1"&gt;</description></item><item><title>re: 2 + 2 equals "Monday Evening"</title><link>http://blogs.msdn.com/b/powershell/archive/2007/01/09/2-2-equals-monday-evening.aspx#1440308</link><pubDate>Wed, 10 Jan 2007 00:01:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1440308</guid><dc:creator>nlhowell</dc:creator><description>&lt;p&gt;I had no idea you were so musical.&lt;/p&gt;
&lt;p&gt;My guess is that PowerShell makes a special exception for division.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1440308" width="1" height="1"&gt;</description></item><item><title>re: 2 + 2 equals "Monday Evening"</title><link>http://blogs.msdn.com/b/powershell/archive/2007/01/09/2-2-equals-monday-evening.aspx#1440156</link><pubDate>Tue, 09 Jan 2007 23:04:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1440156</guid><dc:creator>Jeffrey L Whitledge</dc:creator><description>&lt;p&gt;But you said in the previous post that the data type of the result is the data type of the first operand. So how does the int get converted to a double?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1440156" width="1" height="1"&gt;</description></item></channel></rss>