FlexibleParser code
NumberParser code (.NET/C#) >
Adapted native mathematical functionalities
Additionally to the custom methods described in the previous section, Math2 also includes NumberD-adapted versions of all the .NET native System.Math functions. Most of the code of all these implementations is stored in the files and subfolders of the Math2 folder whose names include "Existing".

The NumberX calculation rules aren't fully applicable to these situations, where the format of the given native method has to be met. For example, NumberD numberD = Math2.Abs(new NumberD(12345, 6789)); triggers an error because the input number (i.e., 12345*10^6789) is outside the maximum range supported by System.Math.Abs (i.e., the double type range).

On the other hand, the NumberD versions can deal with most of the scenarios involving numeric types not supported by the native methods. For example, NumberD numberD = Math2.Cos(123.456m); (with 123.456m being implicitly converted to new NumberD(123.456m)) works fine despite the impossibility of double val = Math.Cos(123.456m);. In these situations, NumberParser performs a conversion to the most adequate natively-supported type (double in this example).