Skip to content

About issue related to acl2/books/projects/arm/second/fdiv8/fdiv8.cpp. #1609

Open

Description

@Lottie-ui

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!

Activity

  1. russinoff commented on Jul 19, 2024

    @russinoff
    Contributor
  2. Lottie-ui commented on Jul 22, 2024

    @Lottie-ui
    Author

    @russinoff , hello, after my experiment, after being modified to ui2, the result remains the same.

  3. mayankmanj commented on Jul 22, 2024

    @mayankmanj
    Contributor

    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?

  4. Lottie-ui commented on Jul 23, 2024

    @Lottie-ui
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions