zeroshade commented on code in PR #1555:
URL: https://github.com/apache/arrow-go/pull/1555#discussion_r4588449415
##########
parquet/internal/encoding/alp_scaling_test.go:
##########
@@ -33,13 +33,18 @@ func TestALPFastRoundFloat32(t *testing.T) {
{"positive integer", 5.0, 5},
{"positive round up", 2.7, 3},
{"positive round down", 2.3, 2},
- {"positive half", 2.5, 2}, // round-to-even via magic trick
+ {"positive half", 2.5, 2}, // a tie goes to the even integer
{"negative integer", -5.0, -5},
{"negative round up", -2.3, -2},
{"negative round down", -2.7, -3},
{"zero", 0.0, 0},
{"small positive", 0.1, 0},
{"large integer", 12345.0, 12345},
+ // Whole numbers past 2^22, which adding and subtracting a
constant
+ // would move.
+ {"past 2^22", 5000001, 5000001},
+ {"largest odd", 16777215, 16777215},
+ {"negative past 2^22", -5000001, -5000001},
Review Comment:
Added in a98810a8. Each table now covers the largest whole number below, the
boundary itself, and the smallest whole number above, for both signs, at two
boundaries:
- 2^22 (2^51 for `DOUBLE`), where adding and subtracting the constant stops
rounding correctly.
- 2^24 (2^53), past which the type holds only even whole numbers, so the
smallest one above is 2^24 + 2.
The old rounding fails on 2^22 + 1 and 2^24 − 1 and passes the rest. So the
cases show both where it broke and how far the fix reaches.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]