|
| |||||||||
| Tags: compiler, core 2 duo, sqrt, square root, visual cpp |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Square root and Visual C++ compiler
Suppose that: 1) you create a new C++ (Empty C++) in Visual Studio 2008 Express. 2) you have a Core 2 Duo 6400@2.13GHz like mine or something 3) we write, compile and execute this code: Code: # include <math.h>
int main (void)
{
sqrt (71634.4174f);
return 0;
} For info, I found this, about the Core 2 Duos: Quote:
I ask this because I have tested the execution time of 10 million once a sqrt () and 10 million times a root obtained by the Newton algo precisely, and I was surprised to get a time 2/3 or 3/4 lower with a code made by hand. So, what is VC++ compiler will do with a code like that? |
|
#2
| ||||
| ||||
| Re: Square root and Visual C++ compiler
sqrt drew implementation lib by sellers who will be optimized or not. Under VC, it should be used after implementation IEE SUN MATH 754 or approaching. 1 from Newton-Raphson enough time or your proxy is to be near 10-4 lead to 10-8. It's the same trick in Altivec. And in fact, we wrote more assembler to pr ESS kind since 10 years, should see to keep up |
|
#3
| ||||
| ||||
| Re: Square root and Visual C++ compiler
Under visual there is a pragma to enable intrinsic, including sqrt. You can also use an optional compiler, I know that. It depends on your compiler and its configuration, not your processor. If in doubt, compile in release + debug info (possible) and look at the assembly. |
|
#4
| ||||
| ||||
| Re: Square root and Visual C++ compiler
OK, I try to use #pragma intrinsic (sqrt) but strangely it is not recognized by the compiler: Quote:
|
|
#5
| ||||
| ||||
| Re: Square root and Visual C++ compiler Quote:
Of course, not necessarily for general public applications, but it exists. VC in the compilation of SSE intrinsics does all the time not the same as the inline assembler. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Square root and Visual C++ compiler" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| fatal error C1060: compiler is out of heap space in visual studio | Dannai7 | Software Development | 5 | 15-06-2011 08:10 AM |
| DCDiag Test - DNS Root hints list has invalid root hint server | Sean | Windows Server Help | 5 | 07-06-2010 11:47 PM |
| Square Root Symbol In Java | Sheenas | Software Development | 5 | 27-01-2010 10:27 AM |
| How can I find square root using c program? | ScarFace 01 | Software Development | 5 | 06-01-2010 02:16 PM |
| Compiler Error in Visual Studio 6,while adding OpenGL as header files. | Santanio | Software Development | 2 | 12-01-2009 08:40 PM |