-
Notifications
You must be signed in to change notification settings - Fork 347
fpcmp: Allow decimal numbers ending with a period #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for working on this. Could you add one or more tests in tools/test? There are some there that you may be model off of, if needed. That may help prevent regressions like this. |
After 8a84a50, fpcmp requires at least one post-decimal digit when period present. This leads to incorrect comparison results for 628.pop2_s of SPEC2017 because this program outputs `65.` when the Fortran compiler is flang while the reference output is `65.0`.
Thanks. Added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests.
tools/test/CMakeLists.txt
Outdated
@@ -19,6 +23,10 @@ add_dependencies(abrt not) | |||
llvm_test_run(EXECUTABLE "$<TARGET_FILE:not>" "--crash" "$<TARGET_FILE:abrt>") | |||
llvm_add_test_for_target(abrt) | |||
|
|||
# Check that fpcmp can handle decimal numbers ending with a period correctly. | |||
llvm_test_run(EXECUTABLE "$<TARGET_FILE:fpcmp-target>" "-a" "0.03" "-r" "0.03" "-i" "%b/test/fpcmp-input1" "%b/test/fpcmp-input2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tolerance of 0.03 here seems fairly large. Do you expect that it will fail if it is made smaller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
628_pop2 uses 0.03 for both absolute and relative tolerance.
# SPEC Test has both absolute and relative tolerance with same order
speccpu2017_verify_output(IGNORE_WHITESPACE ABSOLUTE_TOLERANCE 0.03 RELATIVE_TOLERANCE 0.03)
How about using a bigger value in the test file? For example: change 3.0E-02
to 1003.0E-02
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
628_pop2 uses 0.03 for both absolute and relative tolerance.
# SPEC Test has both absolute and relative tolerance with same order speccpu2017_verify_output(IGNORE_WHITESPACE ABSOLUTE_TOLERANCE 0.03 RELATIVE_TOLERANCE 0.03)
How about using a bigger value in the test file? For example: change
3.0E-02
to1003.0E-02
.
Thanks for the clarification. Since this was motivated by 628_pop2 anyway, the tolerance is probably appropriate. There's no need for larger values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes. We should consider adding more tests to explicitly check for error conditions, whitespace etc. but that can be done separately.
LGTM.
After 8a84a50, fpcmp requires at least one post-decimal digit when period present. This leads to incorrect comparison results for 628.pop2_s of SPEC2017 because this program outputs
65.
if the Fortran compiler is flang while the reference output is65.0
.