rustyconover opened a new pull request, #552: URL: https://github.com/apache/datasketches-cpp/pull/552
`req_sketch`'s constructor computes `k_` with `std::max<uint8_t>`, so any `k` of 256 or more wraps around: ```cpp req_sketch<float>(256).get_k(); // 4 req_sketch<float>(500).get_k(); // 244 req_sketch<float>(1024).get_k(); // 4 ``` Everything else already treats `k` as 16 bits: the constructor parameter, the `k_` member and the serialized format. The documented range (and the Java implementation's check) is [4, 1024]. This changes the one `std::max<uint8_t>` to `std::max<uint16_t>`; odd values still round down. Added a test, `req sketch: k above 255`. It checks k of 256, 500 and 1024, an odd k (1001 → 1000), and that k = 1024 survives serialization in estimation mode. Without the fix it fails with `4 == 256`. With it, all REQ tests pass. We found this through the [DuckDB DataSketches extension](https://github.com/Query-farm/datasketches), where users asking for K = 1024 were silently getting K = 4. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
