Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

_Quad type math errors

handsomeforest
1,749 Views

I downloaded and installed the latest intel oneAPI (w_BaseKit_p_2022.1.0.116_offline).  I have the following code in Visual Studio 2022.

int main() {
_Quad n = 23.1416Q;
int m = (int)__log10q(n); // there is a bug in Intel 2021 compiler. need to do cast here
int mm = __log10q(n);
printf("m = %d, mm = %d", m, mm);
if (mm != m) {
printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!n = %g, m = %d, mm = %d\n", (double)n, m, mm);
}
return m;
}

However, I got the following wrong errors:

debug x64: m = 2, mm = 2

release x64: m = 2, mm = 2

debug x86: m = -4859, mm = -4859

release x86: m = -4939, mm = -4939

I believe the correct result should be m = 1, mm = 1.

 

Attached here is the test project.  Can you try to reproduce the problem on your end?  Thanks

 

Junlin Xu

0 Kudos
11 Replies
NoorjahanSk_Intel
Moderator
1,710 Views

Hi,

 

Thanks for reaching out to us.

 

We are able to reproduce your issue with icx compiler(2022.1) at our end.

We are working on your issue. We will get back to you soon.

 

Meanwhile, could you please try using icl classic compiler? As we are able to get the expected results for both x64, x86 in both debug and release mode.

 

Please find the below screenshot(x86 Debug and x64 Release) for more details with the classic compiler(19.2) in Visual Studio 2022 with oneAPI 2022.1

NoorjahanSk_Intel_0-1640342128572.pngNoorjahanSk_Intel_1-1640342171092.png

NoorjahanSk_Intel_2-1640342313125.pngNoorjahanSk_Intel_3-1640342328481.png

 

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
handsomeforest
1,690 Views

Thank you for the confirmation, Noorjahan.  

 

I do not see Intel C++ 19.2 on my visual studio 2022.  I only see the option of Intel C++ 16.0 classic which I purchased in 2016.  When I do use Intel C++ 16.0, I got build errors as shown here.  How can I get Intel C++ 19.2 option appear on Visual Studio 2022?  Is it free?

 

Junlin Xu

 

handsomeforest_0-1640355896281.png

 

0 Kudos
NoorjahanSk_Intel
Moderator
1,666 Views

Hi,


>> How can I get Intel C++ 19.2 option appear on Visual Studio 2022?..


Could you please confirm whether you have installed oneAPI HPC toolkit in your system?

If not, please download and install oneAPI HPC Toolkit as the Intel classic compiler comes with this toolkit.


>>Is it free?


Yes, it is free. You can download oneAPI HPC Toolkit from the below link

https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit-download.html


Please do let us know if you face any issues.


Thanks & Regards,

Noorjahan.


0 Kudos
handsomeforest
1,657 Views

Noorjahan:

 

I can confirm that Intel C++ 19.2 works for me.  Please do let me know if when the bug is fixed in Intel C++ 2022.

 

Thanks.

 

Junlin Xu

0 Kudos
NoorjahanSk_Intel
Moderator
1,635 Views

Hi,


We are working on your issue. We will get back to you soon.


Thanks & Regards,

Noorjahan.


0 Kudos
Devorah_H_Intel
Moderator
1,369 Views

This issue was fixed in the latest oneAPI release. 

0 Kudos
handsomeforest
333 Views

Hello @Devorah_H_Intel , I tried the latest 2024 oneAPI release on my Windows 10 with Visual Studio 2022 v17.8.2.  The 64-bit build is fixed while the 32-bit build is not.  Attached is my test app again.  The following is the summary of the results:

//-----------------------------------------------------------------------------------------------------

_Quad n = 23.1416Q;
int m = (int)__log10q(n); // bug in intel c++ 2024 compiler for 32-bit build?
int mm = __log10q(n);
printf("m = %d, mm = %d", m, mm);


// yields in 32-bit debug: m = -4935, mm = -4935
// yields in 32-bit release: m = -4939, mm = -4939
// yields in 64-bit debug: m = 1, mm = 1
// yields in 64-bit debug: m = 1, mm = 1

//-----------------------------------------------------------------------------------------------------

 

I just wanted to make sure that Intel C++ 2024 compiler can compile 32-bit target application.  Thanks.

0 Kudos
Devorah_H_Intel
Moderator
271 Views

@handsomeforest wrote:

Hello @Devorah_H_Intel , I tried the latest 2024 oneAPI release on my Windows 10 with Visual Studio 2022 v17.8.2.  The 64-bit build is fixed while the 32-bit build is not.  Attached is my test app again.  The following is the summary of the results:

//-----------------------------------------------------------------------------------------------------

_Quad n = 23.1416Q;
int m = (int)__log10q(n); // bug in intel c++ 2024 compiler for 32-bit build?
int mm = __log10q(n);
printf("m = %d, mm = %d", m, mm);


// yields in 32-bit debug: m = -4935, mm = -4935
// yields in 32-bit release: m = -4939, mm = -4939
// yields in 64-bit debug: m = 1, mm = 1
// yields in 64-bit debug: m = 1, mm = 1

//-----------------------------------------------------------------------------------------------------

 

I just wanted to make sure that Intel C++ 2024 compiler can compile 32-bit target application.  Thanks.


warning : 32 bit tools (PreferredToolArchitecture=x86) are not supported in Intel C++ Compiler toolset. 64 bit tools (PreferredToolArchitecture=x64) are used in this build.

32bit  builds are not supported with icx 

same for ifx

0 Kudos
handsomeforest
258 Views

@Devorah_H_Intel , are you certain that we cannot build 32-bit target using Intel C++ compiler 2024 64-bit tools?  The warning "32 bit tools (PreferredToolArchitecture=x86) are not supported in Intel C++ Compiler toolset. 64 bit tools (PreferredToolArchitecture=x64) are used in this build." is about the build tools, not build target.  I can use Visual C++ 2022 which is a 64-bit build tools to build 32-bit applications.

0 Kudos
Alex_Y_Intel
Moderator
216 Views

Hi @handsomeforest, thanks for your question.  
@Devorah_H_Intel meant that Intel oneAPI compiler no longer compiles/generates binary to be executed on 32-bit machine, and indeed this is the case. Please also be aware that oneAPI base toolkit 2024.0 already has icc/icl (Intel classic compiler for Linux and Windows) removed. 

handsomeforest
175 Views
Reply