-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add reciprocal and SinCos methods to IFloatingPoint #58607
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsBackground and MotivationSuggestion for the generic math. The mentioned methods are available in Math and MathF classes. I think it would be nice to add these to the IFloatingPoint interface. Proposed APInamespace System
{
public interface IFloatingPoint<TSelf>
{
...
+ (TSelf, TSelf) SinCos(TSelf x);
+ TSelf ReciprocalEstimate(TSelf x);
+ TSelf ReciprocalSqrtEstimate(TSelf x);
...
}
}
|
They are more about low-level optimization, when you know the hardware support for some specific type, and looks unsuitable for generic. The interface should contain primitive methods only. |
The functions exist as more than just hardware optimizations and they are fully suitable for use in general algorithms, hence why they are on These were simply missed from the initial preview due to the functions being new in .NET 6. |
Looks good as proposed. namespace System
{
public interface IFloatingPoint<TSelf>
{
+ (TSelf Sin, TSelf Cos) SinCos(TSelf x);
+ TSelf ReciprocalEstimate(TSelf x);
+ TSelf ReciprocalSqrtEstimate(TSelf x);
}
} |
@lilinus are you interested in working on this one? |
This is one that isn't easy to pick up at the moment since it impacts generic math. We're working through several parallel changes to get it in box before additional work/changes can happen here. |
Sure, I can pick it up if @i3arnon who has a PR doesn't want to. Will keep an eye out for when generic math is potentially ready for this change. |
@lilinus Thanks for the heads up. |
Background and Motivation
Suggestion for the generic math. The mentioned methods are available in Math and MathF classes. I think it would be nice to add these to the IFloatingPoint interface.
Proposed API
Oops forgot to add api suggestion label...
The text was updated successfully, but these errors were encountered: