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 cdavid, christian.heimes, mark.dickinson, rhettinger
Date 2009-01-02.15:57:19
SpamBayes Score 1.3661746e-08
Marked as misclassified No
Message-id <1230911841.32.0.50506089114.issue2121@psf.upfronthosting.co.za>
In-reply-to
Content
[Raymond]
> I would
> not like to see that extended to cmath or complex() unless compelling
> real-world use cases arise.

Hmm.  Have you looked at the cmath module recently?  You may be in for a 
nasty surprise...

> Mark, does Inf have a standard interpretation for complex numbers?  Do
> all infinities meet or do they radiate, each with their own phase
> angle?

Shrug.  Mathematically, by far the most common and useful model is the 
complex plane plus a single extra point at infinity.  But when complexes 
are implemented as pairs of floats things look a little strange. Kahan, 
in his 'branch cuts' paper identifies 9 'different' complex infinities 
in this model, and C99 Annex G specifies exactly how functions should 
behave for various different infinities.

It's never really been clear to me how useful it is to be able to 
distinguish these infinities.  But the cmath module *does* make an 
effort to return the 'correct' (according to C99 Annex G) values for 
inputs with a special real or imaginary component.  On balance, I'd 
support making complex('nan + nan*j') do the right thing.

(Though I can't help feeling that the repr of complex(nan, nan)
should have been 'nan + nan*1j' rather than the current 'nan + nan*j'.)

> Also, do you want to stick with the 754 interpretation of NaNs as the
> result of invalid operations

I've never much liked the use of NaN to represent missing values, and
I don't think Python should embrace that usage.
History
Date User Action Args
2009-01-02 15:57:21mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, christian.heimes, cdavid
2009-01-02 15:57:21mark.dickinsonsetmessageid: <1230911841.32.0.50506089114.issue2121@psf.upfronthosting.co.za>
2009-01-02 15:57:20mark.dickinsonlinkissue2121 messages
2009-01-02 15:57:19mark.dickinsoncreate