-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Clarify rounding semantics #49
Comments
I find that Also, I have redone the reference impl as BigDecimal with rounding half-even, and the results don't change (for my file). |
Added a test case from the discussion gunnarmorling#5 (comment) Neither all implementations match baseline: ```sh $ ./test_all.sh src/test/resources/samples/measurements-rounding-baseline.txt 2>/dev/null FAIL armandino FAIL artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas FAIL filiphr FAIL itaske PASS jgrateron FAIL khmarbaise FAIL kuduwa-keshavram PASS lawrey PASS moysesb FAIL nstng PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn PASS seijikun PASS spullara PASS truelive ``` not they match precise value `33.6+31.7+21.9+14.6=25.5`: ``` $ ./test_all.sh src/test/resources/samples/measurements-rounding-precise.txt 2>/dev/null PASS armandino PASS artsiomkorzun FAIL baseline FAIL bjhara FAIL criccomini FAIL ddimtirov PASS ebarlas PASS filiphr PASS itaske FAIL jgrateron PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey FAIL moysesb PASS nstng FAIL padreati PASS palmr FAIL richardstartin PASS royvanrijn FAIL seijikun FAIL spullara FAIL truelive ``` For gunnarmorling#49
Added a test case from the discussion gunnarmorling#5 (comment) Neither all implementations match baseline: nor they match precise value of `33.6+31.7+21.9+14.6=25.5`: ``` $ ./test_all.sh src/test/resources/samples/measurements-rounding-baseline.txt 2>/dev/null | tee /tmp/rounding-baseline.log FAIL armandino FAIL artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas FAIL filiphr FAIL itaske PASS jgrateron FAIL khmarbaise FAIL kuduwa-keshavram PASS lawrey PASS moysesb FAIL nstng PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn PASS seijikun PASS spullara PASS truelive $ ./test_all.sh src/test/resources/samples/measurements-rounding-precise.txt 2>/dev/null | tee /tm p/rounding-precise.log PASS armandino PASS artsiomkorzun FAIL baseline FAIL bjhara FAIL criccomini FAIL ddimtirov PASS ebarlas PASS filiphr FAIL itaske FAIL jgrateron PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey FAIL moysesb PASS nstng FAIL padreati PASS palmr FAIL richardstartin PASS royvanrijn FAIL seijikun FAIL spullara FAIL truelive $ git --no-pager diff --word-diff /tmp/rounding-baseline.log /tmp/rounding-precise.log diff --git a/tmp/rounding-baseline.log b/tmp/rounding-precise.log index 76d5b4e..495fb00 100644 --- a/tmp/rounding-baseline.log +++ b/tmp/rounding-precise.log @@ -1,22 +1,22 @@ [-FAIL-]{+PASS+} armandino[-FAIL artsiomkorzun-] PASS {+artsiomkorzun+} {+FAIL+} baseline [-PASS-]{+FAIL+} bjhara [-PASS-]{+FAIL+} criccomini FAIL ddimtirov [-FAIL-]{+PASS+} ebarlas [-FAIL-]{+PASS+} filiphr FAIL itaske [-PASS jgrateron-]FAIL {+jgrateron+} {+PASS+} khmarbaise FAIL kuduwa-keshavram [-PASS-]{+FAIL+} lawrey[-PASS moysesb-] FAIL [-nstng-]{+moysesb+} PASS [-padreati-]{+nstng+} FAIL [-palmr-]{+padreati+} PASS [-richardstartin-]{+palmr+} FAIL [-royvanrijn-]{+richardstartin+} PASS {+royvanrijn+} {+FAIL+} seijikun [-PASS-]{+FAIL+} spullara [-PASS-]{+FAIL+} truelive ``` For gunnarmorling#49
Added two test cases from the discussion gunnarmorling#5 (comment) Neither all implementations match baseline nor they match precise value of `33.6+31.7+21.9+14.6=25.5`: ``` $ ./test_all.sh src/test/resources/samples/measurements-rounding-baseline.txt 2>/dev/null | tee /tmp/rounding-baseline.log FAIL armandino FAIL artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas FAIL filiphr FAIL itaske PASS jgrateron FAIL khmarbaise FAIL kuduwa-keshavram PASS lawrey PASS moysesb FAIL nstng PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn PASS seijikun PASS spullara PASS truelive $ ./test_all.sh src/test/resources/samples/measurements-rounding-precise.txt 2>/dev/null | tee /tm p/rounding-precise.log PASS armandino PASS artsiomkorzun FAIL baseline FAIL bjhara FAIL criccomini FAIL ddimtirov PASS ebarlas PASS filiphr FAIL itaske FAIL jgrateron PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey FAIL moysesb PASS nstng FAIL padreati PASS palmr FAIL richardstartin PASS royvanrijn FAIL seijikun FAIL spullara FAIL truelive $ git --no-pager diff --word-diff /tmp/rounding-baseline.log /tmp/rounding-precise.log diff --git a/tmp/rounding-baseline.log b/tmp/rounding-precise.log index 76d5b4e..495fb00 100644 --- a/tmp/rounding-baseline.log +++ b/tmp/rounding-precise.log @@ -1,22 +1,22 @@ [-FAIL-]{+PASS+} armandino[-FAIL artsiomkorzun-] PASS {+artsiomkorzun+} {+FAIL+} baseline [-PASS-]{+FAIL+} bjhara [-PASS-]{+FAIL+} criccomini FAIL ddimtirov [-FAIL-]{+PASS+} ebarlas [-FAIL-]{+PASS+} filiphr FAIL itaske [-PASS jgrateron-]FAIL {+jgrateron+} {+PASS+} khmarbaise FAIL kuduwa-keshavram [-PASS-]{+FAIL+} lawrey[-PASS moysesb-] FAIL [-nstng-]{+moysesb+} PASS [-padreati-]{+nstng+} FAIL [-palmr-]{+padreati+} PASS [-richardstartin-]{+palmr+} FAIL [-royvanrijn-]{+richardstartin+} PASS {+royvanrijn+} {+FAIL+} seijikun [-PASS-]{+FAIL+} spullara [-PASS-]{+FAIL+} truelive ``` For gunnarmorling#49
Added two test cases from the discussion gunnarmorling#5 (comment) Neither all implementations match baseline nor they match precise value of `33.6+31.7+21.9+14.6=25.5`: ``` $ ./test_all.sh src/test/resources/samples/measurements-rounding-baseline.txt 2>/dev/null | tee /tmp/rounding-baseline.log FAIL armandino FAIL artsiomkorzun PASS baseline PASS bjhara PASS criccomini FAIL ddimtirov FAIL ebarlas FAIL filiphr FAIL itaske PASS jgrateron FAIL khmarbaise FAIL kuduwa-keshavram PASS lawrey PASS moysesb FAIL nstng PASS padreati FAIL palmr PASS richardstartin FAIL royvanrijn PASS seijikun PASS spullara PASS truelive $ ./test_all.sh src/test/resources/samples/measurements-rounding-precise.txt 2>/dev/null | tee /tm p/rounding-precise.log PASS armandino PASS artsiomkorzun FAIL baseline FAIL bjhara FAIL criccomini FAIL ddimtirov PASS ebarlas PASS filiphr FAIL itaske FAIL jgrateron PASS khmarbaise FAIL kuduwa-keshavram FAIL lawrey FAIL moysesb PASS nstng FAIL padreati PASS palmr FAIL richardstartin PASS royvanrijn FAIL seijikun FAIL spullara FAIL truelive $ diff -y /tmp/rounding-baseline.log /tmp/rounding-precise.log FAIL armandino | PASS armandino FAIL artsiomkorzun | PASS artsiomkorzun PASS baseline | FAIL baseline PASS bjhara | FAIL bjhara PASS criccomini | FAIL criccomini FAIL ddimtirov FAIL ddimtirov FAIL ebarlas | PASS ebarlas FAIL filiphr | PASS filiphr FAIL itaske FAIL itaske PASS jgrateron | FAIL jgrateron FAIL khmarbaise | PASS khmarbaise FAIL kuduwa-keshavram FAIL kuduwa-keshavram PASS lawrey | FAIL lawrey PASS moysesb | FAIL moysesb FAIL nstng | PASS nstng PASS padreati | FAIL padreati FAIL palmr | PASS palmr PASS richardstartin | FAIL richardstartin FAIL royvanrijn | PASS royvanrijn PASS seijikun | FAIL seijikun PASS spullara | FAIL spullara PASS truelive | FAIL truelive ``` Its also interesting that e.g. `itaske` produces different results between runs and thus may pass or fail sporadically. For gunnarmorling#49
* first version * second version (0m59s) * third version (0m46s) * fourth version (0m39s) * fifth version (0m18s) * follow naming conventions from project structure * fix rounding (see /issues/49) * formatting changes from build * name should case-match github username * sixth version (14s) * seventh version (11s) * potential fix for other systems? * no need for sdk install * binary should go to ./target * building native-image only when not existing yet
* first version * second version (0m59s) * third version (0m46s) * fourth version (0m39s) * fifth version (0m18s) * follow naming conventions from project structure * fix rounding (see gunnarmorling/issues/49) * formatting changes from build * name should case-match github username * sixth version (14s) * seventh version (11s) * potential fix for other systems? * no need for sdk install * binary should go to ./target * building native-image only when not existing yet
As an exercise I've re-implemented gunnarmorling#375 idea to compare result numbers with a tolerance. But I think this approach is wrong, the rules should define rounding mode and baseline should be fixed to produce the correct result. Submissions should be fixed accordingly or qualified as non-passing. Could have been done earlier but better late than never. Updates gunnarmorling#49
As an exercise I've re-implemented gunnarmorling#375 idea to compare result numbers with a tolerance: ``` $ ./test.sh baseline 0 src/test/resources/samples/measurements-rounding-precise.txt Validating calculate_average_baseline.sh -- src/test/resources/samples/measurements-rounding-precise.txt Rounding=14.6/25.5/33.6 != Rounding=14.6/25.4/33.6 (avg) ``` But I think this approach is wrong, the rules should define rounding mode and baseline should be fixed to produce the correct result. Submissions should be fixed accordingly or qualified as non-passing. Could have been done earlier but better late than never. Updates gunnarmorling#49
As an exercise I've re-implemented gunnarmorling#375 idea to compare result numbers with a tolerance: ``` $ ./test.sh baseline 0 src/test/resources/samples/measurements-rounding-precise.txt Validating calculate_average_baseline.sh -- src/test/resources/samples/measurements-rounding-precise.txt Rounding=14.6/25.5/33.6 != Rounding=14.6/25.4/33.6 (avg) ``` The hassle of parsing highlights the importance of using machine-readable format as suggested in gunnarmorling#14 **But** I think this approach is wrong, the rules should define rounding mode and baseline should be fixed to produce the correct result. Submissions should be fixed accordingly or qualified as non-passing. Could have been done earlier but better late than never. Updates gunnarmorling#49
Done via #392. |
Unfortunately no, see https://github.com/gunnarmorling/1brc/pull/392/files#r1451734941 |
See #5 (comment); CC @AlexanderYastrebov
The text was updated successfully, but these errors were encountered: