Skip to content
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

Use Decimal in floats checker #503

Merged
merged 2 commits into from
Oct 5, 2019
Merged

Use Decimal in floats checker #503

merged 2 commits into from
Oct 5, 2019

Conversation

kiritofeng
Copy link
Member

Closes #456.

@kiritofeng kiritofeng force-pushed the decimal_checker branch 2 times, most recently from c82270d to 8e4dbfd Compare September 30, 2019 22:11
@codecov-io
Copy link

codecov-io commented Sep 30, 2019

Codecov Report

Merging #503 into master will increase coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #503      +/-   ##
==========================================
+ Coverage    72.8%   72.91%   +0.11%     
==========================================
  Files         126      126              
  Lines        3938     3947       +9     
==========================================
+ Hits         2867     2878      +11     
+ Misses       1071     1069       -2
Impacted Files Coverage Δ
dmoj/tests/test_checker.py 96.29% <100%> (+0.29%) ⬆️
dmoj/checkers/floats.py 86.04% <100%> (+9.73%) ⬆️
dmoj/cptbox/tracer.py 82.67% <0%> (-0.5%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 200cf76...7b4cda5. Read the comment docs.

Copy link
Member

@quantum5 quantum5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add unit tests for this.

dmoj/checkers/floats.py Outdated Show resolved Hide resolved
dmoj/checkers/floats.py Outdated Show resolved Hide resolved
@kiritofeng kiritofeng force-pushed the decimal_checker branch 3 times, most recently from cedc046 to a7cb316 Compare October 1, 2019 13:12
@@ -27,7 +28,12 @@ def verify_default(process_float, judge_float, epsilon):
abs(1.0 - process_float / judge_float) <= epsilon)


def check(process_output, judge_output, precision=6, error_mode='default', **kwargs):
def check(process_output, judge_output, precision=6, high_precision=False, error_mode='default', **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about precision and other stuff you can control in the decimal context?

@Xyene Xyene merged commit 55f00b2 into master Oct 5, 2019
@Xyene Xyene deleted the decimal_checker branch October 5, 2019 03:09
quantum5 added a commit that referenced this pull request Oct 5, 2019
Reverts #503.

This is completely broken. The checker will reject anything because `Decimal`
constructor does not accept `bytes`. Once that bug is fixed, the inability to
control `Decimal`'s precision makes the test case fail, since the numbers do
compare equal at default precision.

In other words, the only test case worked by accident.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

checker improvement: make floats checker use arbitrary-precision Decimal
4 participants