<?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>Jay R. Wren - lazy dawg evarlast &#187; MSPL</title>
	<atom:link href="http://jrwren.wrenfam.com/blog/tag/mspl/feed/" rel="self" type="application/rss+xml" />
	<link>http://jrwren.wrenfam.com/blog</link>
	<description>babblings of a computer loving fool</description>
	<lastBuildDate>Fri, 16 Jul 2010 02:34:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>double.IsNaN is 100 times slower</title>
		<link>http://jrwren.wrenfam.com/blog/2010/02/05/double-isnan-is-100-times-slower/</link>
		<comments>http://jrwren.wrenfam.com/blog/2010/02/05/double-isnan-is-100-times-slower/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 20:16:43 +0000</pubDate>
		<dc:creator>jrwren</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[MSPL]]></category>

		<guid isPermaLink="false">http://jrwren.wrenfam.com/blog/2010/02/05/double-isnan-is-100-times-slower/</guid>
		<description><![CDATA[Its not just your programming group that can’t get it right. I work in a semi-disfunctional group on contract for a client who, not matter how hard we try, doesn’t seem to listen to basic software engineering principles.
I feel a little better (and a great deal worse after thinking about it) when I see that [...]]]></description>
			<content:encoded><![CDATA[<p>Its not just your programming group that can’t get it right. I work in a semi-disfunctional group on contract for a client who, not matter how hard we try, doesn’t seem to listen to basic software engineering principles.</p>
<p>I feel a little better (and a great deal worse after thinking about it) when I see that the largest software company in the world deals with some of the same problems.</p>
<p>I found this gem in the WPFToolkit (it is MSPL) source.</p>
<blockquote><p>// The standard CLR double.IsNaN() function is approximately 100 times slower than our own wrapper,     <br />// so please make sure to use DoubleUtil.IsNaN() in performance sensitive code.      <br />// PS item that tracks the CLR improvement is DevDiv Schedule : 26916.      <br />// IEEE 754 : If the argument is any value in the range 0&#215;7ff0000000000001L through 0&#215;7fffffffffffffffL       <br />// or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result will be NaN.&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />public static bool IsNaN(double value)      <br />{      <br />&#160;&#160;&#160; NanUnion t = new NanUnion();      <br />&#160;&#160;&#160; t.DoubleValue = value; </p>
<p>&#160;&#160;&#160; ulong exp = t.UintValue &amp; 0xfff0000000000000;     <br />&#160;&#160;&#160; ulong man = t.UintValue &amp; 0&#215;000fffffffffffff;      <br />&#160;&#160;&#160; return (exp == 0&#215;7ff0000000000000 || exp == 0xfff0000000000000) &amp;&amp; (man != 0);      <br />}</p>
<p>&#160;</p>
</blockquote>
<p>My jaw was open pretty far for quite a few seconds as I read this.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrwren.wrenfam.com/blog/2010/02/05/double-isnan-is-100-times-slower/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
