[issue32171] Inconsistent results for fractional power of -infinity

2017-12-01 Thread Pierre Denis
Pierre Denis added the comment: > So this justifies things like `sqrt(-0.0)` giving a zero result (rather than > being considered invalid) Well, I didn’t noticed that the wolf was already in the henhouse! This choice seems disputable for me because it is precisely a case

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-30 Thread Tim Peters
Tim Peters added the comment: Mark, indeed, in the email from Vincent Lefevre you linked to, his entire argument was: (a) we already specified what happens when the base is a zero; so, (b) for each of the six pow(a_zero, y) cases we specified, derive a matching rule for an

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-30 Thread Mark Dickinson
Mark Dickinson added the comment: > I continue to wonder what is the rationale for these specifications So I can't speak with any authority: I'm only an interested bystander when it comes to IEEE 754, but I believe this particular behaviour stems from two desires: 1. The

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Pierre Denis
Pierre Denis added the comment: Thanks, Tim & Mark. This indeed clarifies and gives a good rationale on Python implementation. Nevertheless, despite the authority arguments, I continue to wonder what is the rationale for these specifications. Probably the debate should

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Tim Peters
Tim Peters added the comment: No worries, Mark :-) Odd things happen sometimes when people are editing near the same time. BTW, of course I agree with closing this! -- ___ Python tracker

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: Sorry, Tim. It looks as though I un-nosied you (de-nosied you?) accidentally. Not sure how that happened. -- nosy: +tim.peters ___ Python tracker

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: Having read through the rest of that grouper.ieee.org, thread, there doesn't seem to be any disagreement with what Vincent suggests. So I believe that Python's behaviour is consistent with (a) C99, (b) MPFR, and (c) the spirit of IEEE

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: See also this posting [1], where the omission is discussed, and Vincent Lefevre suggests that the behaviour should be: > pow (±inf, y) is +inf with no exception for finite y > 0 and not an odd integer [1]

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: We follow C99 for this case, which says (C99 F 9.4.4): > pow(−∞, y) returns +∞ for y > 0 and not an odd integer. Oddly, this clause seems to be missing from section 9.2.1 of IEEE 754. Nevertheless, I believe it's the right thing to do.

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Tim Peters
Tim Peters added the comment: As a comment in the referenced patch says, the intent of the patch was to make behavior match the C99 spec. Among other things, C99's annex F (section F.9.4.4 "The pow functions") says: """ — pow(−∞, y) returns −0 for y an odd integer < 0. —

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Ned Deily
Change by Ned Deily : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list

[issue32171] Inconsistent results for fractional power of -infinity

2017-11-29 Thread Pierre Denis
New submission from Pierre Denis : Python returns inconsistent results when negative infinity is raised to a non-integer power. This happens with the ** operator as well as with the pow and math.pow functions. The most blatant symptom occurs with power 0.5, which is