nathanpjones / DecimalMath

The math support for Decimal that Microsoft forgot and more.
MIT License
47 stars 13 forks source link

DecimalEx.Log does not return #11

Open cvxMR opened 3 years ago

cvxMR commented 3 years ago

For small inputs, e.g. 0.000000002, DecimalEx.Log does not return or at least takes an absurd amount of time. For aforementioned value the algorithm requires ~1000000000 iterations to reach adequate precision (2 decimal places). This function should switch to a different algorithm for small values and this limitation should be mentioned in the readme and function comment. Also: if (nextAdd == 0) break; You never compare float/double/decimal with == or !=, especially when it is the only break condition in an infinite loop. Use Abs(x) < Tolerance instead.

3dGrabber commented 1 year ago

Just ran into that same issue...