-
-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Stride.Math with the new .NET 7 System.Numerics interfaces #1570
Comments
I like this idea. But we definitely need to figure out a good shape of the interface (for example I don't like that distance is abstract but distance squared isn't - what if this vector is using a different distance measure?) and I think it should be public rather than internal. From the performance standpoint - these methods are static. For each struct type a new specialized variant will be generated at runtime and inlining should apply as normal. |
For System.Numerics i think we have two things related to that discussion And for the abstract Distance function, i haven't yet found a way to call Math.Sqrt without having to cast the number to double, there doesn't seem to be any interface that allows this behavior. Will keep searching or we can wait an see what's going to come in .NET 8+ |
Thanks for the reference to those issues. Have you seen this reddit question? https://www.reddit.com/r/csharp/comments/ti11e1/can_i_cast_an_inumber_or_similar_to_systemdouble/ You can use |
Also some good discussion here dotnet/runtime#24168 and one of the recent comments suggested looking at Silk.NET.Maths |
Can I suggest not doing this unless it is part of a replacement for |
Using the newly added abstract static method for interfaces we can reduce code repetition.
This shouldn't affect anything but number of lines of code for the vector implementations.
Some questions to answer before going forward with it :
Implementation
Interface
The text was updated successfully, but these errors were encountered: