Skip to content

Commit 1aca9df

Browse files
committed
Read zero ratios as 0 ints
Signed-off-by: James Hamlin <jfhamlin@gmail.com>
1 parent deecdff commit 1aca9df

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/reader/reader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,10 @@ func (r *Reader) readNumber(numStr string) (interface{}, error) {
11381138
if denomBig.ToBigInteger().Cmp(big.NewInt(0)) == 0 {
11391139
return nil, r.error("divide by zero")
11401140
}
1141+
// if num is 0, return 0
1142+
if numBig.ToBigInteger().Cmp(big.NewInt(0)) == 0 {
1143+
return int64(0), nil
1144+
}
11411145

11421146
return lang.NewRatioBigInt(numBig, denomBig), nil
11431147
}

0 commit comments

Comments
 (0)