zeroshade commented on code in PR #926:
URL: https://github.com/apache/iceberg-go/pull/926#discussion_r3119372350


##########
transforms.go:
##########
@@ -561,6 +561,19 @@ type TimeTransform interface {
        Transformer(Type) (func(any) Optional[int32], error)
 }
 
+// floorDiv performs floored integer division, rounding toward negative 
infinity.
+// Unlike Go's truncated division (which rounds toward zero), this correctly
+// handles negative dividends — e.g., floorDiv(-1, 3600000000) = -1, not 0.
+// This matches the behavior of Java's Math.floorDiv.
+func floorDiv(a, b int64) int64 {

Review Comment:
   any reason not to generalize this?
   
   ```go
   func floorDiv[T constraints.Integer](a, b T) T {
   ```



-- 
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]

Reply via email to