Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: incorrect parsing with non-dot decimal separator #35

Closed
Bykiev opened this issue Apr 23, 2024 · 1 comment · Fixed by #40
Closed

BUG: incorrect parsing with non-dot decimal separator #35

Bykiev opened this issue Apr 23, 2024 · 1 comment · Fixed by #40
Assignees
Labels

Comments

@Bykiev
Copy link
Contributor

Bykiev commented Apr 23, 2024

Description
When rounding the value with culture where decimal separator is comma an error has occured.

Error/Exception Message
System.FormatException: "The value could not be parsed."

в System.Numerics.BigNumber.ParseBigInteger(ReadOnlySpan`1 value, NumberStyles style, NumberFormatInfo info)
   в System.Numerics.BigNumber.ParseBigInteger(String value, NumberStyles style, NumberFormatInfo info)
   в ExtendedNumerics.BigDecimal.GetWholePart()
   в ExtendedNumerics.BigDecimal.Round(BigDecimal value, MidpointRounding mode)

Expected Behavior
The value should be correctly parsed

Actual Behavior
An error has occured: System.FormatException: "The value could not be parsed."

Steps To Reproduce

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator = ",";

var res = new BigDecimal(17.56);
var e = BigDecimal.Round(res, MidpointRounding.AwayFromZero);
@Bykiev
Copy link
Contributor Author

Bykiev commented Apr 25, 2024

I'm working on this, will create PR soon

@Protiguous Protiguous assigned Bykiev and unassigned AdamWhiteHat Apr 25, 2024
Bykiev added a commit to Bykiev/BigDecimal that referenced this issue Apr 25, 2024
Fix using comma as decimal separator

Closes AdamWhiteHat#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants