[Python-ideas] checking for identity before comparing built-in objects
Tim Peters
tim.peters at gmail.com
Fri Oct 12 21:42:34 CEST 2012
More information about the Python-ideas mailing list
Fri Oct 12 21:42:34 CEST 2012
- Previous message: [Python-ideas] checking for identity before comparing built-in objects
- Next message: [Python-ideas] checking for identity before comparing built-in objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Mark Dickinson] > ... > And as for sqrt(-0.0) returning -0.0... Grr. I've never understood > the motivation for that one, especially as it disagrees with the usual > recommendations for complex square root (where the real part of the > result *always* has its sign bit cleared). The only rationale I've seen for this is in Kahan's obscure paper "Branch Cuts for Complex Elementary Functions or Much Ado About Nothing's Sign Bit". Hard to find. Here's a mostly readable scan: http://port70.net/~nsz/articles/float/kahan_branch_cuts_complex_elementary_functions_1987.pdf In part it's to preserve various identities, such as that sqrt(conjugate(z)) is the same as conjugate(sqrt(z)). When z is +0, that becomes sqrt(conjugate(+0)) same_as conjugate(sqrt(+0)) which is sqrt(-0) same_as conjugate(+0) which is sqrt(-0) same as -0 Conviced? LOL. There are others in the paper ;-)
- Previous message: [Python-ideas] checking for identity before comparing built-in objects
- Next message: [Python-ideas] checking for identity before comparing built-in objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list