mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 10:38:57 +00:00
Fix power calculation when encoding the BigDecimal into NUMERIC (#1692)
* Show failing test 0.002 will be encoded as 0.02 * The power calculation should depend on the offset of the digits
This commit is contained in:
@@ -115,7 +115,7 @@ impl TryFrom<&'_ BigDecimal> for PgNumeric {
|
||||
digits.push(base_10_to_10000(first));
|
||||
}
|
||||
} else if offset != 0 {
|
||||
digits.push(base_10_to_10000(&base_10) * 10i16.pow(3 - base_10.len() as u32));
|
||||
digits.push(base_10_to_10000(&base_10) * 10i16.pow((offset - base_10.len()) as u32));
|
||||
}
|
||||
|
||||
if let Some(rest) = base_10.get(offset..) {
|
||||
|
||||
Reference in New Issue
Block a user