Vector.Ceilling<T>, Vector.Floor<T> #62991
-
In System.Numerics.Vector static class, in .NET6, the following ceiling and floor types are supported:
Since the class Vector is generic, is there a reason there are no generic implementation for these methods? Demonstration of the desired method: public static Vector<T> System.Numerics.Vector.Ceiling<T>(Vector<T> vector)
{
//All 'typeof' checks are optimized in compile time by JIT,
//Also could possibly be implemented nicely with Generic Math in the future (static abstracts in interfaces)
if (typeof(T) == typeof(Double))
{
return Vector.Ceiling(vector); // internal Double implementation
}
if (typeof(T) == typeof(Single))
{
return Vector.Ceiling(vector); //internal Single implementation
}
//possible future ceiling support for half and other floating point types
//if (typeof(T) == typeof(Half))
//{
// return Vector.Ceiling(vector); //internal Half implementation
//}
return vector; // ceiling does nothing
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sounds somehow reasonable. You can open an API suggestion issue. |
Beta Was this translation helpful? Give feedback.
Sounds somehow reasonable. You can open an API suggestion issue.