Skip to content

Conversation

jeffhandley
Copy link
Member

Per dotnet/docs#41835, the format from Complex.ToString changed in .NET 8 from (a, b) to <a; b>.

Summary

Fixes dotnet/runtime#93454

Per dotnet/docs#41835, the format from Complex.ToString changed in .NET 8 from (a, b) to <a; b>
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics

Copy link

Learn Build status updates of commit d4ca96f:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Numerics/Complex.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Let's :shipit:

@BillWagner BillWagner merged commit eff36b0 into dotnet:main Jul 19, 2024
## Remarks
The default string representation of a complex number displays the number using its Cartesian coordinates in the form `(`*a*`,` *b*`)`, where *a* is the real part of the complex number, and *b* is its imaginary part. Both *a* and *b* are formatted using the general format specifier ("G") and the conventions of the current system culture.
The default string representation of a complex number displays the number using its Cartesian coordinates in the form `<`*a*`;` *b*`>`, where *a* is the real part of the complex number, and *b* is its imaginary part. Both *a* and *b* are formatted using the general format specifier ("G") and the conventions of the current system culture.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffhandley It seems like we should keep the old and new syntax and annotate them with the versions they're applicable to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can send a follow up PR, @gewarren. Would the following wording be good? Please feel free to offer refinement to it.

Suggested change
The default string representation of a complex number displays the number using its Cartesian coordinates in the form `<`*a*`;` *b*`>`, where *a* is the real part of the complex number, and *b* is its imaginary part. Both *a* and *b* are formatted using the general format specifier ("G") and the conventions of the current system culture.
The default string representation of a complex number displays the number using its Cartesian coordinates in the form `<`*a*`;` *b*`>`, where *a* is the real part of the complex number, and *b* is its imaginary part. Both *a* and *b* are formatted using the general format specifier ("G") and the conventions of the current system culture. In .NET 7 and earlier, the form `(`*a*`, `*b*`)` was used.

Copy link
Contributor

@gewarren gewarren Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The default string representation of a complex number displays the number using its Cartesian coordinates in the form `<`*a*`;` *b*`>`, where *a* is the real part of the complex number, and *b* is its imaginary part. Both *a* and *b* are formatted using the general format specifier ("G") and the conventions of the current system culture.
The default string representation of a complex number displays the number using its Cartesian coordinates in the form `<`*a*`;` *b*`>` (or `(`*a*`, `*b*`)` in .NET 7 and earlier versions), where *a* is the real part of the complex number, and *b* is its imaginary part. Both *a* and *b* are formatted using the general format specifier ("G") and the conventions of the current system culture.

@jeffhandley This would be my recommended wording.

@jeffhandley jeffhandley deleted the jeffhandley/complex-tostring branch July 19, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complex.ToString format changed from (a, b) to <a; b>

3 participants