AdamWhiteHat / BigDecimal

An arbitrary-precision decimal (base 10) floating-point number class. Over 2.5 million downloads on NuGet!
MIT License
53 stars 15 forks source link

BUG: converting to double results to 0 #36

Closed Bykiev closed 7 months ago

Bykiev commented 7 months ago

Description When casting the BigDecimal variable to double the value is getting zero

Error/Exception Message No

Expected Behavior The value should be correctly converted to double

Actual Behavior The value is getting zero

Steps To Reproduce

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

 var temp = BigDecimal.Pow(10, -1);
 var value = new BigDecimal(99.00000001);
 var res = BigDecimal.Divide(value, temp);

 double res2 = (double)res;