This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson, rhettinger, steven.daprano, tim.peters, yang8621
Date 2021-04-26.07:40:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There's an implicit float-to-double conversion here (`fp.contents.value` is represented as a Python float, which is backed by a C double). What you're seeing is that converting the single-precision signaling NaN to double precision loses the signaling bit, producing a quiet double-precision NaN with the same sign and payload (modulo the signaling bit). That's what I'd expect under IEEE 754 semantics. (IEEE 754-2008 says, in section 6.2, "Under default exception handling, any operation signaling an invalid operation exception and for which a floating-point result is to be delivered shall deliver a quiet NaN.".)

I don't think there's anything we can or should do about this at Python level. ctypes is correctly reflecting the existing C-level behaviour. In other words, this is expected behaviour, not a bug.
Date User Action Args
2021-04-26 07:40:59mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, steven.daprano, yang8621
2021-04-26 07:40:59mark.dickinsonsetmessageid: <>
2021-04-26 07:40:59mark.dickinsonlinkissue43940 messages
2021-04-26 07:40:58mark.dickinsoncreate