Skip to content

Default validator relative error#427

Merged
gkreitz merged 2 commits into
Kattis:masterfrom
Matistjati:default-validator-relative-error
May 25, 2026
Merged

Default validator relative error#427
gkreitz merged 2 commits into
Kattis:masterfrom
Matistjati:default-validator-relative-error

Conversation

@Matistjati
Copy link
Copy Markdown
Contributor

@Matistjati Matistjati commented May 25, 2026

For context, the current output validator doesn't list the relative error, which can be frustrating:

Wrong answer on line 1 of output (corresponding to line 1 in answer file)
Too large difference.
 Judge: 155432.5000000000
 User: 155432.2666462104
 Difference: 2.333538e-01
 (abs tol 1.000000e-06 rel tol 1.000000e-06)

The relative error is "obviously" almost good enough, but too far away. Exactly how far away? I would prefer to not have to pull up a calculator to find.

Now that the code is already being touched, I propose we do the following changes:

  • Also calculate and show relative error
  • Add an extra space to align judge and user numbers
  • Change "difference" to "Absolute error" (and have it actually be the absolute error)

Example output:

Wrong answer on line 1 of output (corresponding to line 1 in answer file)
Too large difference.
 Judge: 100
 User:  105
 Absolute error: 5.000000e+00 (abs tolerance -1.000000e+00)
 Relative error: 5.000000e-02 (rel tolerance 1.000000e-02)

I still don't think it's perfect: showing a negative tolerance is slightly confusing. However, fixing the printing for that in a non-hacky way would likely require a minor rewrite, which I feel is not worth it.

@gkreitz gkreitz merged commit 5dccb0d into Kattis:master May 25, 2026
5 checks passed
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.

2 participants