Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.

_Quad type math errors

handsomeforest
Beginner
641 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
6 Replies
NoorjahanSk_Intel
Moderator
602 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.

 

handsomeforest
Beginner
582 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

 

NoorjahanSk_Intel
Moderator
558 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.


handsomeforest
Beginner
549 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

NoorjahanSk_Intel
Moderator
527 Views

Hi,


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


Thanks & Regards,

Noorjahan.


Devorah_H_Intel
Moderator
261 Views

This issue was fixed in the latest oneAPI release. 

Reply