You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add reciprocal and SinCos methods to IFloatingPoint #58607
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.
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.
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 Math/MathF and not some other type.
These were simply missed from the initial preview due to the functions being new in .NET 6.
@lilinus Thanks for the heads up.
I indeed want it but AFAICT my existing PR is good enough at this moment.
I can update it accordingly when the other generic math changes are done.
Activity
huoyaoyuan commentedon Sep 3, 2021
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.
tannergooding commentedon Sep 7, 2021
The functions exist as more than just hardware optimizations and they are fully suitable for use in general algorithms, hence why they are on
Math/MathFand not some other type.These were simply missed from the initial preview due to the functions being new in .NET 6.
bartonjs commentedon Sep 21, 2021
Video
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); } }Add reciprocal and SinCos methods to IFloatingPoint
danmoseley commentedon Mar 8, 2022
@lilinus are you interested in working on this one?
tannergooding commentedon Mar 8, 2022
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.
lilinus commentedon Mar 15, 2022
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.
i3arnon commentedon Mar 15, 2022
@lilinus Thanks for the heads up.
I indeed want it but AFAICT my existing PR is good enough at this moment.
I can update it accordingly when the other generic math changes are done.