| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Co-authored-by: Victor Stinner <vstinner@python.org>
There was a problem hiding this comment.
LGTM. The implementation looks complete and well tested.
Sorry, something went wrong.
| memcpy(ptr, &x, sizeof(x)); | ||
| } | ||
| else { | ||
| float x[2] = {(float)c.real, (float)c.imag}; |
There was a problem hiding this comment.
I wasn't sure of the behavior on underflow or overflow of the double to float cast, so I tested:
>>> import struct, sys
>>> data=struct.pack('F', 0.0) * 4
>>> m=memoryview(bytearray(data)).cast('F')
>>> m[0]=math.nextafter(0, 1)
>>> m[1]=sys.float_info.min
>>> m[2]=sys.float_info.max
>>> m[3]=float("nan")
>>> m.tolist()
[0j, 0j, (inf+0j), (nan+0j)]I got the values that I expected. I suppose that these conversions are well specified by IEEE 754.
Sorry, something went wrong.
There was a problem hiding this comment.
The behavior here is same as for 'f' format, just component-wise, see PACK_SINGLE macro.
Sorry, something went wrong.
…e-146151.4-lhim.rst Co-authored-by: Victor Stinner <vstinner@python.org>
|
Merged, thanks for your contribution. |
Sorry, something went wrong.
…x) (python#146241) Co-authored-by: Victor Stinner <vstinner@python.org>
… (complex) (python#146241)" This reverts commit c68a194.
…x) (python#146241) Co-authored-by: Victor Stinner <vstinner@python.org>
| Back | FazBrowse Home | New Git URL |
📚 Documentation preview 📚: https://cpython-previews--146241.org.readthedocs.build/