AdamWhiteHat / BigRational

Arbitrary precision rational number class
MIT License
24 stars 2 forks source link

BUG: Parse(Double input) fails , if CurrentCulture has NumberFormat with 'comma' instead of 'dot' #15

Closed AdamWhiteHat closed 1 year ago

AdamWhiteHat commented 1 year ago

Description BigDecimal Parse(Double input) => Parse(input.ToString(CultureInfo.CurrentCulture)); uses CurrentCulture to convert double into string, while next step uses BigDecimalNumberFormatInfo, which is InvariantCulture: public static BigDecimal Parse(String input) { return Parse(input, BigDecimalNumberFormatInfo); }

So, If CurrentCulture's NumberFormat is not similar to InvarantCulture, Parse + all releated tests will fail. Example: new CultureInfo("ru-RU") has 'comma' for decimal point.

Same issue as BigDecimal/issues/16 reported by Degot. This issue exists in both these libraries.