In C# 11, static abstract interface members enable writing generic math classes that work on float, double, and Half simultaneously:
public readonly record struct Vector3<T>(T X, T Y, T Z) where T : INumber<T>, IRootFunctions<T> {
public static Vector3<T> operator +(Vector3<T> a, Vector3<T> b) => new(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
public static Vector3<T> operator -(Vector3<T> a, Vector3<T> b) => new(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
public T LengthSquared() => X * X + Y * Y + Z * Z;
public T Length() => T.Sqrt(LengthSquared());
}One single struct definition handles any numeric precision with JIT monomorphization!