Enhanced C#
Language of your choice: library documentation

This class helps generic code to perform calculations on numbers of unknown type, by providing access to various math interfaces. More...
This class helps generic code to perform calculations on numbers of unknown type, by providing access to various math interfaces.
T  A numeric type. 
If a certain math interface is not available for a certain type, then the corresponding field will be null. For example, Maths<int>.FloatMath is null because int is not floatingpoint. The Traits, Math, and related properties will be null for nonnumeric types.
TODO: support nonbuiltin types!
Generic code that uses Maths<T> is slower than code that uses a generic parameter with a math constraint. That's because generic struct parameters are earlybound and can be inlined, while calls through an interface such as IMath<T> are normal latebound interface calls and cannot be inlined. Compare the two examples below.
// Calculates the length of a vector with magnitude (x, y): // Slower version based on Maths<T>. Example: Length(3.0,4.0) public T Length<T>(T x, T y) { var m = Maths<T>.Math; return m.Sqrt(m.Add(m.Square(x), m.Square(y))); }
// Calculates the length of a vector with magnitude (x, y): // Faster version based on Maths<T>. Unfortunately, this version is // inconvenient to call because the caller must specify which math // provider to use. Example: Length<double,MathD>(3.0,4.0) public T Length<T,M>(T x, T y) where M:struct,IMath<T> { var m = default(M); return m.Sqrt(m.Add(m.Square(x), m.Square(y))); }
Public static fields  
static readonly INumTraits< T >  Traits = Get() as INumTraits<T> 
static readonly IMath< T >  Math = Get() as IMath<T> 
static readonly ISignedMath< T >  SignedMath = Get() as ISignedMath<T> 
static readonly IUIntMath< T >  UIntMath = Get() as IUIntMath<T> 
static readonly IIntMath< T >  IntMath = Get() as IIntMath<T> 
static readonly IRationalMath< T >  RationalMath = Get() as IRationalMath<T> 
static readonly IFloatMath< T >  FloatMath = Get() as IFloatMath<T> 
static readonly IComplexMath< T >  ComplexMath = Get() as IComplexMath<T> 
static readonly IConvertTo< T >  NumConverter = Get() as IConvertTo<T> 
static readonly IOrdered< T >  Ordered = Get() as IOrdered<T> 
static readonly IIncrementer< T >  Inrementer = Get() as IIncrementer<T> 
static readonly IBitwise< T >  Bitwise = Get() as IBitwise<T> 
static readonly IBinaryMath< T >  BinaryMath = Get() as IBinaryMath<T> 
static readonly IAdditionGroup< T >  AdditionGroup = Get() as IAdditionGroup<T> 
static readonly ITrigonometry< T >  Trigonometry = Get() as ITrigonometry<T> 
static readonly IHasRoot< T >  HasRoot = Get() as IHasRoot<T> 
static readonly IExp< T >  Exp = Get() as IExp<T> 
static readonly IMultiply< T >  Multiply = Get() as IMultiply<T> 
static readonly IMultiplicationGroup< T >  MultiplicationGroup = Get() as IMultiplicationGroup<T> 
static readonly IRing< T >  Ring = Get() as IRing<T> 
static readonly IField< T >  Field = Get() as IField<T> 