( 65536 - 65536 ) / 65536 = -92559592117431994000000000000000000000000000000000000000000000.000000

( 65536 - 65536 ) / 65536 = -92559592117431994000000000000000000000000000000000000000000000.000000

Please take a look at a Test-Case in DEBUG configuration (!):

...
printf( ">> Result 1: %f\\n", ( ( 65536 - 65536 ) / 65536 ) * 100.0f );
printf( ">> Result 2: %f\\n", ( ( 65536 - 65536 ) / 65536 ) );
...

Here are outputs for different C/C++ compilers:

Intel C++ compiler ( Composer XE 2011 Update 9 ):

>> Result 1: 0.000000
>> Result 2: -92559592117431994000000000000000000000000000000000000000000000.000000

Intel C++ compiler command line options:
/c /Od /I "..\\..\\Include" /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_WIN32_ICC"
/D "_VC80_UPGRADE=0x0710" /D "_UNICODE"
/D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /Yu"Stdphf.h" /Fp"Debug\\IccTestAppD.pch" /Fo"Debug/"
/W5 /nologo /ZI /TP /U "_WIN32_MSC" /U "_WIN32CE_MSC" /U"WIN32_PLATFORM_PSPC"
/U"WIN32_PLATFORM_WFSP" /U "WIN32_PLATFORM_WM50" /U "_WIN32_MGW" /U "_WIN32_BCC"
/U "_COS16_TCC" /Qopenmp /Qdiag-disable:111,673

Microsoft C++ compiler:

>> Result 1: 0.000000
>> Result 2: 0.000000

Borland C++ compiler:

>> Result 1: 0.000000
>> Result 2: 0.000000

MinGW C++ compiler:

>> Result 1: 0.000000
>> Result 2: 0.000000

Turbo C++ compiler:

>> Result 1: 0.000000
>> Result 2: 0.000000

Development Environment:

OS: Windows XP 32-bit
IDE: Visual Studio 2005 SP1
Compilers: Intel C++ / Microsoft C++ / Borland C++ / MinGW / Turbo C++

Best regards,
Sergey

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I could not reproduce the issue:

c:\forum\U105043>type tst.cpp

// tst.cpp

#include

int main()

{

printf( ">> Result 1: %f\n", ( ( 65536 - 65536 ) / 65536 ) * 100.0f );

printf( ">> Result 2: %f\n", ( ( 65536 - 65536 ) / 65536 ) );

return 0;

}

c:\forum\U105043>icl /fp:precise /MTd /Qopenmp tst.cpp

Intel C++ Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

tst.cpp

Microsoft Incremental Linker Version 10.00.40219.01

Copyright (C) Microsoft Corporation. All rights reserved.

-out:tst.exe

-nodefaultlib:libiompprof5mt.lib

-nodefaultlib:libiompprof5md.lib

-defaultlib:libiomp5md.lib

-nodefaultlib:vcomp.lib

-nodefaultlib:vcompd.lib

tst.obj

c:\forum\U105043>tst

>> Result 1: 0.000000

>> Result 2: 0.000000

Is there something I am missing?

Quoting Om Sachan (Intel)...
c:\forum\U105043>icl /fp:precise /MTd /Qopenmp tst.cpp

You didn't set all my compileroptions.

Intel C++ Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011

Is there something I am missing?

My Intel C++ Composerversion is:

Intel C++ Composer XE 2011 Update 9, Version 12.1.1109.2005

Did you try the test case inthe Debug and Releaseconfigurations? As I stated in my initial post it happens in a Debug
configuration only.

Quoting Om Sachan (Intel)Is there something I am missing?

Pleasetry with these compiler options:

/c /Od/D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_VC80_UPGRADE=0x0710" /D "_UNICODE"
/D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W5 /nologo /ZI /TP/Qopenmp

Best regards,
Sergey

You compiler version string does not seem to be correct.

I am still not able to reproduce the issue.

c:\forum\U105043> icl /Od /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W5 /ZI /TP /Qopenmp tst.cpp

Intel C++ Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

tst.cpp

tst.cpp(9): warning #181: argument is incompatible with corresponding format str

ing conversion

printf( ">> Result 2: %f\n", ( ( 65536 - 65536 ) / 65536 ) );

^

Microsoft Incremental Linker Version 10.00.40219.01

Copyright (C) Microsoft Corporation. All rights reserved.

-out:tst.exe

-debug

-pdb:tst.pdb

-nodefaultlib:libiompprof5mt.lib

-nodefaultlib:libiompprof5md.lib

-defaultlib:libiomp5md.lib

-nodefaultlib:vcomp.lib

-nodefaultlib:vcompd.lib

tst.obj

c:\forum\U105043>tst

>> Result 1: 0.000000

c:\forum\U105043> cl /Od /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_UNICODE" /D

"UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W3 /ZI /TP /openmp tst.cpp

Microsoft 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86

Copyright (C) Microsoft Corporation. All rights reserved.

tst.cpp

Microsoft Incremental Linker Version 10.00.40219.01

Copyright (C) Microsoft Corporation. All rights reserved.

/out:tst.exe

/debug

tst.obj

c:\forum\U105043>tst

>> Result 1: 0.000000

>> Result 2: 0.000000

Quoting Om Sachan (Intel)

You compiler version string does not seem to be correct.
...

What exactly do you mean? I don't think that a '...compiler version string...' created that problem.

Best regards,
Sergey

The compiler is rightforthe warning on the following statement :

printf( ">> Result 2: %f\n", ( ( 65536 - 65536 ) / 65536 ) );

The Intel compiler generated binary produces the same result as Microsoft compiler generated binary.

Did you try tests in Debug and Release configurations with my compiler options?

I'll try to do another set of tests some time later and will provide more technical details.

Best regards,
Sergey

Leave a Comment

Please sign in to add a comment. Not a member? Join today