bugGNU Octave - Bugs: bug #57908, complex exponentiation...


bug #57908: complex exponentiation compatibility issue

Submitter:  John W. Eaton <jwe>
Submitted:  Thu 27 Feb 2020 05:48:53 PM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  jwe Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 27 Feb 2020 06:34:12 PM UTC, comment #1: 

This is part of a much bigger issue with std::pow().  Interesting that we both came across it at the same time.  See bugs #57671, #57476, #54302, #52706.

Let me write something up for the Octave-Maintainers list (later today or tomorrow).

Rik <rik5>
Group administrator
Thu 27 Feb 2020 05:48:53 PM UTC, original submission:  

In Octave,

x = complex (0, 0);
x ^ x  => NaN + NaNi
0 ^ 0 => 1

but I believe Matlab the complex exponentiation also returns 1 (or complex (1,0) if narrowing doesn't apply).

Do we need to hunt down and eliminate all uses of std::pow for complex arguments?

Would it be better to eliminate direct use of std::complex and use our own class derived from std::complex and that overloads pow with a function that does what we need for compatibility?

Have we discussed this issue previously?  If so, I didn't find a bug report about it.

John W. Eaton <jwe>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-27 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code