static GM() { if (!JemUtil.IsNumericType <TData>()) { throw new ArithmeticException(); } }
static GM() { if (!JemUtil.IsNumericType <TData>()) { throw new InvalidOperationException($"Type {typeof(TData).Name} is not a numeric type."); } }
public unsafe static double GenericSqrt <TReturn>(TReturn l) where TReturn : struct { if (!JemUtil.IsNumericType <TReturn>()) { throw new ArithmeticException(); } switch (l) { case SByte v: return(Math.Sqrt(v)); case Byte v: return(Math.Sqrt(v)); case Int32 v: return(Math.Sqrt(v)); case UInt32 v: return(Math.Sqrt(v)); case Int16 v: return(Math.Sqrt(v)); case UInt16 v: return(Math.Sqrt(v)); case Int64 v: return(Math.Sqrt(v)); case UInt64 v: return(Math.Sqrt(v)); default: throw new ArithmeticException(); } }