FlexibleParser code

NumberParser code (.NET/C#) >
Custom mathematical functionalities
Math2 includes all the mathematical functionalities of NumberParser, divided into the following two main groups:
• Non-natively-supported implementations, which I developed from scratch and are analysed below. All this code is stored in the files and folders including "New" in their names.
• NumberD-adapted versions of the .NET native System.Math methods, which are discussed in the next section. These implementations are included in the "Existing" files and folder.
Math2 contains the following custom methods:
• PowDecimal/SqrtDecimal. These decimal-based methods are more accurate and support higher precisions/ranges (i.e., up to 26 decimal digits and over ±10^2147483647) than their native floating-point counterparts (i.e., System.Math's Pow/Sqrt).
Project 10 analyses both algorithms and the underlying calculation approach in detail.
• RoundExact/TruncateExact. They extend System.Math's Round/Truncate functionalities by bringing into account new scenarios (e.g., rounding/truncating before/after the decimal point via RoundSeparator) or by complementing existing ones (e.g., RoundType.MidpointToZero, an eventuality not accounted by the native MidpointRounding).
Note that the structure of these two methods was an output of one of my CoreFX issues.
• GetPolynomialFit/ApplyPolynomialFit. These methods calculate (least squares) and apply the coefficients of a second degree polynomial fit.
GetPolynomialFit returns a Polynomial variable with the coefficients best fitting the training x/y arrays. This output, together with the dependent value associated with the result to be calculated, is taken by ApplyPolynomial to perform the corresponding calculations (i.e., A + B*x + C*x^2).
• Factorial. It calculates the factorial of any positive integer number up to 99999.