Skip to content

Commit

Permalink
fraction bugfix (#1579)
Browse files Browse the repository at this point in the history
  • Loading branch information
oandrew committed Jun 6, 2024
1 parent 51ed2cf commit 66abef6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/transformers/fraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,12 @@ func (tr *TransformerFraction) Transform(
} else {
numerator = value
}

denominator := sumsForGroup[fractionFieldName]
if !mlrval.Equals(value, tr.zero) {

// Return 0 for 0/n
if mlrval.Equals(numerator, tr.zero) {
outputValue = tr.zero
} else if !mlrval.Equals(denominator, tr.zero) {
outputValue = bifs.BIF_divide(numerator, denominator)
outputValue = bifs.BIF_times(outputValue, tr.multiplier)
} else {
Expand Down

0 comments on commit 66abef6

Please sign in to comment.