[phobos] [D-Programming-Language/phobos] 8e26e2: Complex.opBinaryRight for numeric types, to allow ...

GitHub noreply at github.com
Mon Dec 9 09:28:19 PST 2013


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: 8e26e2d8cead244296000edc116a93cfcce3241a
      https://github.com/D-Programming-Language/phobos/commit/8e26e2d8cead244296000edc116a93cfcce3241a
  Author: Joseph Rushton Wakeling <joe at webdrake.net>
  Date:   2013-12-09 (Mon, 09 Dec 2013)

  Changed paths:
    M std/complex.d

  Log Message:
  -----------
  Complex.opBinaryRight for numeric types, to allow numeric ^^ complex operations.

The current design takes advantage of the fact that we know
we're dealing with a number whose argument is either 0 or PI.
An alternative design would be to just create a complex number
whose real part is equal to the input, and then raise it to
the power of this:

    return typeof(return)(lhs, 0) ^^ this;

This would generate probably less precisely calculated values
but would be 100% consistent with complex ^^ complex calculations.


  Commit: 2de19c7f7b13f63c1d74487ce4063b4283e97eae
      https://github.com/D-Programming-Language/phobos/commit/2de19c7f7b13f63c1d74487ce4063b4283e97eae
  Author: monarch dodra <monarchdodra at gmail.com>
  Date:   2013-12-09 (Mon, 09 Dec 2013)

  Changed paths:
    M std/complex.d

  Log Message:
  -----------
  Merge pull request #1740 from WebDrake/numeric-op-complex

Fix Issue 11652: support numerical ^^ complex operations in std.complex


Compare: https://github.com/D-Programming-Language/phobos/compare/624499f0487b...2de19c7f7b13


More information about the phobos mailing list