D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Sun Jun 13 09:38:33 2010

# std.complex

Module that will replace the built-in types cfloat, cdouble, creal, ifloat, idouble, and ireal.

Authors:
Lars Tandle Kyllingstad

License:
Boost License 1.0

struct Complex(T) if (isFloatingPoint!(T));
  A complex number parametrised by a type T.

  BUGS:
  Some operators, such as opAssign and opOpAssign, should return by ref, but currently don't. This will be implemented as soon as DMD bug 2460 is fixed.

  T re;
    The real part of the number.

  T im;
    The imaginary part of the number.

  const T abs();
    Calculate the absolute value (or modulus) of the number.

  const T arg();
    Calculate the argument (or phase) of the number.

  const Complex conj();
    Return the complex conjugate of the number.

  template toString(Writer,String) if (isOutputRange!(Writer,String))
    Convert the complex number to a string representation, and pass it to the output range writer.

    The output format is controlled via formatSpec, which should consist of a single POSIX format specifier, without the percent (%) character. Note that complex numbers are floating point numbers, so the only valid format characters are 'e', 'f', 'g', 'a', and 's', where 's' gives the default behaviour. Positional parameters are not valid.

    See the std.format documentation for more information.

    const void toString(ref Writer writer, String formatSpec);
      Convert the complex number to a string representation, and pass it to the output range writer.

      The output format is controlled via formatSpec, which should consist of a single POSIX format specifier, without the percent (%) character. Note that complex numbers are floating point numbers, so the only valid format characters are 'e', 'f', 'g', 'a', and 's', where 's' gives the default behaviour. Positional parameters are not valid.

      See the std.format documentation for more information.

Complex!(CommonType!(T,U)) fromPolar(T, U)(T modulus, U argument);
  Construct a complex number given its absolute value and argument.

Copyright (c) 2010, Lars T. Kyllingstad. | Page generated by Ddoc.