Software Archive
Read-only legacy content
17060 Discussions

Expression assignment problem on MIC

Chang_X_
Beginner
406 Views

I faced a strange problem. My program is running on MIC, and after I finished calculating an expression then assigned it to a variable, the problem cracked. The variable I assigned right now keeps zero and the assignment didn't work. The code looks like that:

wp[index] = p * w[l-1]
printf("%f w:%f p:%f should be %f\n", wp[index],w[l-1],o,w[l-1]*p);

The output is strange, 'wp[index]' is zero but w[l-1]*p isn't. The final result is also zero, so I don't think it's only a block of print.

I also checked ASM code 'icpc' generate. It seems all right and the instruction 'movss' does really exist.

Does anyone have faced similar problems? I have no idea about it.

0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
406 Views

Depending on formatting, a tiny number may print as 0.0. Is this the case (tiny number).

Try printing out the hex (%x) of the values instead of float (%f). A true 0.0 will display as 0x0000

Jim Dempsey

0 Kudos
Reply