[cfe-users] Are these bugs for the clang compilers?
Tianyou via cfe-users
cfe-users at lists.llvm.org
Tue May 26 20:31:30 PDT 2020
I found some questionable behaviors in the clang compiler.
I tried to calculate the smallest number in my machine with clang. I did it by looping as:
a = a / 1.73
In g++, after 1358 loops, I found that a = 4.94066E-324, and the value of a never changes from loop 1358 till the end 1500 loop.
It is questionable for me that a non zero real number here a = 4.94066E-324 divided by a non zero and non one real number here 1.73 will keep the same value. The phenomenon seems to the qualification of the ground state energy in a quantum system.
Is this bug for the clang compiler?
I tested my code with, g++ (Apple LLVM version 10.0.0, clang-1000.10.44.4) on Macintosh. I also tried a = a / 1.7, a = a / 1.77.
All have similar results. A ground state qualification and unchanged value of a.
I guess that it is related to the binary system used by the computer system.
Here with my codes.
Postdoc researcher in National Tsing Hua University
Please send me to
yitianyoucn at qq.com
yitianyou9711 at gzemail.cn
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-users