[flang] Fix float-number representation bug
authorPeixinQiao <qiaopeixin@huawei.com>
Thu, 14 Apr 2022 13:28:30 +0000 (21:28 +0800)
committerPeixinQiao <qiaopeixin@huawei.com>
Thu, 14 Apr 2022 13:28:30 +0000 (21:28 +0800)
commit0ff322246bcd5c20fdda5e6d1215ee961db2abdc
treec84942b1c3bb505d07873ebc6d7da9aedadeb1da
parente5a5e008256c20f4c2d870d687eda4caef25f9ea
[flang] Fix float-number representation bug

The float number is represented as (-1)^s * 1.f * 2^(-127) for 32-bit,
where s is the signed flag, f is the mantissa. When the exponent bits
are all zeros, the float number is represented as (-1)^s * 0.f *2^(-126)
for 32-bit, in which case, the intPart is '0'.

Reviewed By: Jean Perier

https://reviews.llvm.org/D123673
flang/lib/Evaluate/real.cpp
flang/test/Lower/Intrinsics/real.f90 [new file with mode: 0644]
flang/unittests/Evaluate/real.cpp