Mark Dickinson <dicki...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43940>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to