[Python-Dev] Not-a-Number

Steven D'Aprano steve at pearwood.info
Fri Apr 29 07:28:23 CEST 2011


Robert Kern wrote:
> On 4/28/11 8:44 PM, Steven D'Aprano wrote:
>> Greg Ewing wrote:
>>> Taking a step back from all this, why does Python allow
>>> NaNs to arise from computations *at all*?
>>>> The real question should be, why does Python treat all NANs as 
>> signalling NANs
>> instead of quiet NANs? I don't believe this helps anyone.
>> Actually, Python treats all NaNs as quiet NaNs and never signalling NaNs.

Sorry, did I get that backwards? I thought it was signalling NANs that 
cause a signal (in Python terms, an exception)?
If I do x = 0.0/0 I get an exception instead of a NAN. Hence a 
signalling NAN.
-- 
Steven


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /