Skip to content

Commit

Permalink
Fix decimal parsing issue for scientific notation in DbfNumericDecima…
Browse files Browse the repository at this point in the history
…lField

The `DbfNumericDecimalField` class in the `NetTopologySuite.IO.Esri` library failed to correctly parse numeric fields in scientific notation (e.g., "9.095630227029324e-05") due to the use of `decimal.Parse` without `NumberStyles.Float`. This resulted in a format exception.

Updated the parsing logic to use `NumberStyles.Float` with `decimal.Parse` to handle scientific notation correctly.

Affected class: `DbfNumericDecimalField`
  • Loading branch information
DiegoNetoMartins committed Sep 5, 2024
1 parent c43e9fc commit fdf3bbb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DbfNumericDecimalField(string name) : this(name, MaxFieldLength, MaxField
/// <inheritdoc/>
protected override decimal StringToNumber(string s)
{
return decimal.Parse(s, CultureInfo.InvariantCulture);
return decimal.Parse(s, NumberStyles.Float, CultureInfo.InvariantCulture);
}
}
}

0 comments on commit fdf3bbb

Please sign in to comment.