-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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 support for C99 complex type (_Complex) to the struct module #121249
Comments
Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
Implemented by change 7487db4. |
IMO, we should provide a support for long double complex in struct module.
|
But we don't have support for long double here. I don't know for sure why it wasn't here historically, will dig into it. Probably together with support for long double - a support for long double complex will also make sense. |
Even long double is not supported? It seems like support for long double complex now is partial. |
Maybe is. The long double is a more complex beast: https://en.wikipedia.org/wiki/Long_double |
I would prefer to not support long double, it looks complicated for little usage. |
@vstinner, I don't think it's too complicated. On technical side we, probably, have to add only PyFloat_Pack/Unpack16() and PyFloat_Pack/Unpack10() functions for the IEEE 754 quadruples and the x86 extended precision format. Say, "m" and "o" format codes for the struct module.
These are popular standards and it's nice to have conversion helpers, available in the Python. The "F" format for the long double complex type will be implemented like "E" and "C", i.e. using IEEE binary128. If that sounds, I'll open an issue. Hardly discussion on d.p.o does make sense. |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Feature or enhancement
Proposal:
The struct module has support for
float
anddouble
types, so at least there should be alsofloat _Complex
anddouble _Complex
. I'll work on a patch.Initial version
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: