jackc / pgtype

MIT License
319 stars 112 forks source link

Fix numeric to float64 conversion #212

Closed jschaf closed 10 months ago

jschaf commented 10 months ago

A previous optimization in 50933c00 had a logic bug when converting pgtype.Numeric to a float64:

        // BUG: An exponent of one means multiply by 10.
    if src.Exp == 1 {
        return float64(src.Int.Int64()), nil
    }

I think the current pgtype.Numeric float64 conversion is incorrect for integers with an exponent of 1, that are divisible by 10, meaning [10, 20, 30, ..., 90].

210