<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Test results for CRT-function 'sqrt' for different Floating Point Models in Software Tuning, Performance Optimization &amp; Platform Monitoring</title>
    <link>https://community.intel.com/t5/Software-Tuning-Performance/Test-results-for-CRT-function-sqrt-for-different-Floating-Point/m-p/942770#M2009</link>
    <description>Intel C++ compiler supports &lt;STRONG&gt;four&lt;/STRONG&gt; Floating Point Models:

&lt;STRONG&gt;Fast&lt;/STRONG&gt;, &lt;STRONG&gt;Precise&lt;/STRONG&gt;, &lt;STRONG&gt;Strict&lt;/STRONG&gt; and &lt;STRONG&gt;Fast=2&lt;/STRONG&gt;

and test results demonstrate how performance is affected when CRT-function &lt;STRONG&gt;sqrt&lt;/STRONG&gt; is called ( results are in ASC order ):

&lt;STRONG&gt;[ Fast=2 (/fp:fast=2) [Intel C++] ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 203 ticks
        Last Result: 134217728.000^0.5 = 11585.236
CRT Sqrt - double - Calculating the Square Roots - 750 ticks
        Last Result: 134217728.000^0.5 = 11585.237

&lt;STRONG&gt;[ Fast (/fp:fast) ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 219 ticks
        Last Result: 134217728.000^0.5 = 11585.236
CRT Sqrt - double - Calculating the Square Roots - 750 ticks
        Last Result: 134217728.000^0.5 = 11585.237

&lt;STRONG&gt;[ Precise (/fp:precise) ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 422 ticks
        Last Result: 134217728.000^0.5 = 11585.237
CRT Sqrt - double - Calculating the Square Roots - 750 ticks
        Last Result: 134217728.000^0.5 = 11585.237

&lt;STRONG&gt;[ Strict (/fp:strict) ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 875 ticks
        Last Result: 134217728.000^0.5 = 11585.237
CRT Sqrt - double - Calculating the Square Roots - 2969 ticks
        Last Result: 134217728.000^0.5 = 11585.237

As you can see &lt;STRONG&gt;Fast=2&lt;/STRONG&gt; is the fastest Floating Point Model, and &lt;STRONG&gt;Strict&lt;/STRONG&gt; is the slowest ( slower in 875 / 203 = ~4.3x ).</description>
    <pubDate>Wed, 13 Feb 2013 01:55:10 GMT</pubDate>
    <dc:creator>SergeyKostrov</dc:creator>
    <dc:date>2013-02-13T01:55:10Z</dc:date>
    <item>
      <title>Test results for CRT-function 'sqrt' for different Floating Point Models</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Test-results-for-CRT-function-sqrt-for-different-Floating-Point/m-p/942770#M2009</link>
      <description>Intel C++ compiler supports &lt;STRONG&gt;four&lt;/STRONG&gt; Floating Point Models:

&lt;STRONG&gt;Fast&lt;/STRONG&gt;, &lt;STRONG&gt;Precise&lt;/STRONG&gt;, &lt;STRONG&gt;Strict&lt;/STRONG&gt; and &lt;STRONG&gt;Fast=2&lt;/STRONG&gt;

and test results demonstrate how performance is affected when CRT-function &lt;STRONG&gt;sqrt&lt;/STRONG&gt; is called ( results are in ASC order ):

&lt;STRONG&gt;[ Fast=2 (/fp:fast=2) [Intel C++] ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 203 ticks
        Last Result: 134217728.000^0.5 = 11585.236
CRT Sqrt - double - Calculating the Square Roots - 750 ticks
        Last Result: 134217728.000^0.5 = 11585.237

&lt;STRONG&gt;[ Fast (/fp:fast) ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 219 ticks
        Last Result: 134217728.000^0.5 = 11585.236
CRT Sqrt - double - Calculating the Square Roots - 750 ticks
        Last Result: 134217728.000^0.5 = 11585.237

&lt;STRONG&gt;[ Precise (/fp:precise) ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 422 ticks
        Last Result: 134217728.000^0.5 = 11585.237
CRT Sqrt - double - Calculating the Square Roots - 750 ticks
        Last Result: 134217728.000^0.5 = 11585.237

&lt;STRONG&gt;[ Strict (/fp:strict) ]&lt;/STRONG&gt;

32-bit Windows platform
CRT Sqrt - float  - Calculating the Square Roots - 875 ticks
        Last Result: 134217728.000^0.5 = 11585.237
CRT Sqrt - double - Calculating the Square Roots - 2969 ticks
        Last Result: 134217728.000^0.5 = 11585.237

As you can see &lt;STRONG&gt;Fast=2&lt;/STRONG&gt; is the fastest Floating Point Model, and &lt;STRONG&gt;Strict&lt;/STRONG&gt; is the slowest ( slower in 875 / 203 = ~4.3x ).</description>
      <pubDate>Wed, 13 Feb 2013 01:55:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Test-results-for-CRT-function-sqrt-for-different-Floating-Point/m-p/942770#M2009</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-02-13T01:55:10Z</dc:date>
    </item>
    <item>
      <title>Here are source codes of the</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Test-results-for-CRT-function-sqrt-for-different-Floating-Point/m-p/942771#M2010</link>
      <description>Here are source codes of the test case:

#ifndef _WIN32_WINNT
#define _WIN32_WINNT			0x0501
#endif

#include "stdio.h"
#include "tchar.h"
#include "float.h"
#include "math.h"

#include "windows.h"

#ifdef _WIN32_PLATFORM
	#define _WIN_PLATFORM					_T("32-bit Windows platform")
#endif
#ifdef _WIN64_PLATFORM
	#define _WIN_PLATFORM					_T("64-bit Windows platform")
#endif

	#define _USE_CRT_SQRT_FLOAT_
	#define _USE_CRT_SQRT_DOUBLE_

int &lt;STRONG&gt;_tmain&lt;/STRONG&gt;( void )
{
	&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T("%s\n"), _WIN_PLATFORM );

	// Initializations
	unsigned int uiTicksStart = 0U;
	unsigned int uiControlWordx87 = 0U;

	int iV = 0;
	int iNumberOfIterations = 134217728;			// 2^27
	int iDummy = -1;

	float fRes = 0.0f;
	double dRes = 0.0L;

	uiControlWordx87 = &lt;STRONG&gt;_control87&lt;/STRONG&gt;( _PC_53, _MCW_PC );

	// &lt;STRONG&gt;Sub-Test 1 - CRT sqrt - float&lt;/STRONG&gt;
	{
		#ifdef _USE_CRT_SQRT_FLOAT_

		&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T("CRT Sqrt - float  - Calculating the Square Roots") );
		uiTicksStart = ::&lt;STRONG&gt;GetTickCount&lt;/STRONG&gt;();
		for( iV = 0; iV &amp;lt; iNumberOfIterations; iV++ )
		{
			iDummy = -1;

			fRes = &lt;STRONG&gt;sqrt&lt;/STRONG&gt;( ( float )iV );
		}
		&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T(" - %ld ticks\n"), ( int )( ::&lt;STRONG&gt;GetTickCount()&lt;/STRONG&gt; - uiTicksStart ) );
		&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T("\tLast Result: %.3f^0.5 = %.3f\n"), ( float )iV, fRes );

		#endif
	}

	// &lt;STRONG&gt;Sub-Test 2 - CRT sqrt - double&lt;/STRONG&gt;
	{
		#ifdef _USE_CRT_SQRT_DOUBLE_

		&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T("CRT Sqrt - double - Calculating the Square Roots") );
		uiTicksStart = ::&lt;STRONG&gt;GetTickCount&lt;/STRONG&gt;();
		for( iV = 0; iV &amp;lt; iNumberOfIterations; iV++ )
		{
			iDummy = -1;

			dRes = &lt;STRONG&gt;sqrt&lt;/STRONG&gt;( ( double )iV );
		}
		&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T(" - %ld ticks\n"), ( int )( ::&lt;STRONG&gt;GetTickCount&lt;/STRONG&gt;() - uiTicksStart ) );
		&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T("\tLast Result: %.3f^0.5 = %.3f\n"), ( double )iV, dRes );

		#endif
	}

	&lt;STRONG&gt;_tprintf&lt;/STRONG&gt;( _T("Press ESC to Exit...\n") );
	&lt;STRONG&gt;_gettch&lt;/STRONG&gt;();

	return ( int )0;
}</description>
      <pubDate>Wed, 13 Feb 2013 02:02:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Test-results-for-CRT-function-sqrt-for-different-Floating-Point/m-p/942771#M2010</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-02-13T02:02:00Z</dc:date>
    </item>
  </channel>
</rss>

