lostluck commented on a change in pull request #11883:
URL: https://github.com/apache/beam/pull/11883#discussion_r435397313



##########
File path: learning/katas/go/Core Transforms/Combine/CombineFn/pkg/task/task.go
##########
@@ -47,9 +47,9 @@ func (c *averageFn) MergeAccumulators(accumA, accumB 
averageAccum) averageAccum
        }
 }
 
-func (c *averageFn) ExtractOutput(accum averageAccum) float64 {
+func (c *averageFn) ExtractOutput(accum averageAccum) int {

Review comment:
       Henry's right.
   `float64(accum.Sum / accum.Count)` will have integer division fraction 
truncation errors, while `float64(accum.Sum) / float64(accum.Count)` will not.
   
   Go is very specific about requiring explicit conversions between numeric 
types to avoid this kind of error accidentally.
   




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to