You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
About issue related to acl2/books/projects/arm/second/fdiv8/fdiv8.cpp. #1609
To my knowledge, the function tuple<ui64, ui8> fdiv8.cpp(...) in fdiv8.cpp are the implemented CModel of 8-based SRTL algorithms
, which includes a 16/32/64 bit floating-point division implementation.
Note: In order to obtain the 32-bit division implementation CModel in fdiv8.cpp, I set the parameters of fmt, fz, dn, and rmode
in the fdiv8 function to 1, 0, 0, and 0, respectively.
SoftFloat-3e/source/f32_dediv. c is widely recognized as the gold standard for floating-point 32-bit division implementation CModel within the industry.
Note:The rounding mode of this CModel has been set to 0 by default.
So I used a formal verification tool to perform functional equivalence verification on the two CModels mentioned above (fdiv8.cpp and f32-div. c).
One of the counter-examples given is that when the input operands for division are 0x9 and 0x86, the division results of the two CModels(fdiv8.cpp and f32-div. c)
are 0x3D898D50 and 0x3D898D60, respectively.
The results provided by the above formal verification tools are consistent with those obtained by g++.
I would like to ask why there is such a difference between these two CModel models. Please help provide a reasonable explanation.
I look forward to your prompt response. Thank you very much!
I will take a wild guess: your compiler might have a problem with an
implicit conversion from an Algorithmic C register to an enum type. Please
change the line
tuple<bool, ui11, ui52, Class, ui8> analyze(ui64 op, Format fmt, bool fz,
ui8 flags) {
to
tuple<bool, ui11, ui52, Class, ui8> analyze(ui64 op, ui2 fmt, bool fz, ui8
flags) {
and let me know what happens.
On Fri, Jul 19, 2024 at 1:40 AM whitecloudsun ***@***.***> wrote:
To my knowledge, the function tuple<ui64, ui8> fdiv8.cpp(...) in fdiv8.cpp
are the implemented CModel of 8-based SRTL algorithms
, which includes a 16/32/64 bit floating-point division implementation.
Note: In order to obtain the 32-bit division implementation CModel in
fdiv8.cpp, I set the parameters of fmt, fz, dn, and rmode
in the fdiv8 function to 1, 0, 0, and 0, respectively.
SoftFloat-3e/source/f32_dediv. c is widely recognized as the gold standard
for floating-point 32-bit division implementation CModel within the
industry.
Note:The rounding mode of this CModel has been set to 0 by default.
So I used a formal verification tool to perform functional equivalence
verification on the two CModels mentioned above (fdiv8.cpp and f32-div. c).
One of the counter-examples given is that when the input operands for
division are 0x9 and 0x86, the division results of the two
CModels(fdiv8.cpp and f32-div. c)
are 0x3D898D50 and 0x3D898D60, respectively.
The results provided by the above formal verification tools are consistent
with those obtained by g++.
I would like to ask why there is such a difference between these two
CModel models. Please help provide a reasonable explanation.
I look forward to your prompt response. Thank you very much!
—
Reply to this email directly, view it on GitHub
<#1609>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADFJGSN4MEH5XQEQKBQ753TZNCYD7AVCNFSM6AAAAABLD7R7FSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYTQMJVHAYTEOA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Hi @whitecloudsun, I have not been able to reproduce the mismatch using g++ -- compiling fdiv8.cpp with these inputs gives me 0x3D898D60, not 0x3D898D50.
I see the same result with both GNU GCC version 11.3.0 on Linux, and Clang version 15.0.0 on MacOS.
Could you please give us more details of your C++ compiler/compilation environment?
Hi@mayankmanj,according to your reminder, I changed the Linux gcc version to 11.4.0 and obtained the correct result 0x3D898D60.
The gcc version I used before was 9.4.0, and due to compilation errors, I rewrote the case related statements in fdiv8.cpp to if statements, resulting in incorrect results.
Activity
russinoff commentedon Jul 19, 2024
Lottie-ui commentedon Jul 22, 2024
@russinoff , hello, after my experiment, after being modified to ui2, the result remains the same.
mayankmanj commentedon Jul 22, 2024
Hi @whitecloudsun, I have not been able to reproduce the mismatch using g++ -- compiling fdiv8.cpp with these inputs gives me
0x3D898D60, not0x3D898D50.I see the same result with both GNU GCC version 11.3.0 on Linux, and Clang version 15.0.0 on MacOS.
Could you please give us more details of your C++ compiler/compilation environment?
Lottie-ui commentedon Jul 23, 2024
Hi@mayankmanj,according to your reminder, I changed the Linux gcc version to 11.4.0 and obtained the correct result 0x3D898D60.
The gcc version I used before was 9.4.0, and due to compilation errors, I rewrote the case related statements in fdiv8.cpp to if statements, resulting in incorrect results.
Thanks for your answer to this question.