Open ttrolololll opened 2 years ago
Referring to here: https://github.com/jackc/pgtype/blob/12c49ee213fabc092f24b92db6874ed0d319d7b3/ext/shopspring-numeric/decimal.go#L127
case *float32: f, _ := src.Decimal.Float64() *v = float32(f)
The value f should perhaps be checked for overflow against float32, and return an overflow error when it occurs?
f
float32
Maybe... 🤷
shopspring decimal internally uses https://pkg.go.dev/math/big#Rat.Float64 can already overflow the float64 to +Inf. The float64 to float32 does the same thing.
float64
+Inf
Referring to here: https://github.com/jackc/pgtype/blob/12c49ee213fabc092f24b92db6874ed0d319d7b3/ext/shopspring-numeric/decimal.go#L127
The value
f
should perhaps be checked for overflow againstfloat32
, and return an overflow error when it occurs?