-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Implement INumber<T> for System.Numerics.BigInteger and System.Numerics.Complex #70404
Comments
BigInteger already implements INumber<BigInteger>, via IBinaryInteger<BigInteger> and IBinaryNumber<BigInteger>. That was implemented in #68964. How would Complex implement INumber<Complex>.Max(Complex x, Complex y)? |
Omission of IComparisonOperators for Complex was mentioned in dotnet/designs#257 (comment) |
Hello,
Sorry for bothering you… I guess not everybody is welcome in this community… not for n00bs – right?
> BigInteger already implements INumber<BigInteger>, via IBinaryInteger<BigInteger>
Hmm. I’m using .NET 7
7.0.100-preview.4.22252.9
Disambly:
#region Assembly System.Runtime.Numerics, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.0-preview.4.22229.4\ref\net7.0\System.Runtime.Numerics.dll
#endregion
#nullable enable
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace System.Numerics
{
//
// Summary:
// Represents an arbitrarily large signed integer.
public readonly struct BigInteger : IComparable, IComparable<BigInteger>, IEquatable<BigInteger>, IFormattable, ISpanFormattable
{
But I have seen in the pull request diff that the support will be added. So I guess I need to wait for this to be included in a preview release.
Thanks for guiding me 😊
> How would Complex implement INumber<Complex>.Max(Complex x, Complex y)?
Very good point. Then either implement only the subset of INumber that are reasonable OR use one of the suggestions given here: Can a complex number ever be considered 'bigger' or 'smaller' than a real number, or vice versa? - Mathematics Stack Exchange<https://math.stackexchange.com/questions/1116022/can-a-complex-number-ever-be-considered-bigger-or-smaller-than-a-real-number>
IMHO using the Magnitude property could be used. But today complex doesn’t support comparing.
namespace System.Numerics
{
//
// Summary:
// Represents a complex number.
public readonly struct Complex : IEquatable<Complex>, IFormattable
So I guess adding it would be a breaking change.
Von: KalleOlaviNiemitalo ***@***.***>
Gesendet: Dienstag, 7. Juni 2022 03:20
An: dotnet/sdk ***@***.***>
Cc: Reister Hansjoerg (CI/XTE3) ***@***.***>; Author ***@***.***>
Betreff: Re: [dotnet/sdk] Implement INumber<T> for System.Numerics.BigInteger and System.Numerics.Complex (Issue dotnet/runtime#70404)
BigInteger already implements INumber<BigInteger>, via IBinaryInteger<BigInteger> and IBinaryNumber<BigInteger>. That was implemented in dotnet/runtime#68964<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fruntime%2Fpull%2F68964&data=05%7C01%7Cret2fe%40bosch.com%7C6975ca468967472a966608da4823d63a%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C637901615996673791%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JTi0EGwGAPx1ELzJGq%2BxXzszcNRrULMroCC1H5kCNBs%3D&reserved=0>.
How would Complex implement INumber<Complex>.Max(Complex x, Complex y)?
—
Reply to this email directly, view it on GitHub<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fsdk%2Fissues%2F25873%23issuecomment-1148091807&data=05%7C01%7Cret2fe%40bosch.com%7C6975ca468967472a966608da4823d63a%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C637901615996673791%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fVuUeMswSWfNGOIEM2oQ9sOPdbBmXw9O64NAYMJegbA%3D&reserved=0>, or unsubscribe<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGWCM4HYFLXYI4YTSSOZNNTVN2PTZANCNFSM5YAKIAEQ&data=05%7C01%7Cret2fe%40bosch.com%7C6975ca468967472a966608da4823d63a%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C637901615996673791%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3cG2Y5Wo6G4CUgP5kNtLCXEdHHNvSoDXCcCp%2Blror%2Fg%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
That was not my intention. |
Thanks for your interest, @hjrb. This feature is being tracked/worked on in the dotnet/runtime repo, so I'm going to transfer it there for follow-up. |
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsThis would enable generic implementations for Matrix, Vector etc. based on these numeric types.
|
As indicated above, These will be publicly available once .NET 7 Preview 5 is published. |
This would enable generic implementations for Matrix, Vector etc. based on these numeric types.
The text was updated successfully, but these errors were encountered: