D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Wed Dec 30 17:41:25 2009

# std.complex

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

License:
Boost License 1.0.

Authors:
Andrei Alexandrescu

Copyright Andrei Alexandrescu 2008 - 2009. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at ) http:
//www.boost.org/LICENSE_1_0.txt

enum Representation;
  Representation choices for the Complex type. Cartesian representation is better when using additive operations and when real and imaginary part are to be manipulated separately. Polar representation is more advantageous when using multiplicative operations and when modulus and angle are to be manipulated separately.

  cartesian
    Use Cartesian representation.

  polar
    Use polar representation.

struct Complex(Num,Representation rep = Representation.cartesian);
  Complex type parameterized with the numeric type (e.g. float, double, or real) and the representation.

  alias getRe;
    Gets the real component of the number. Might involve a calculation, subject to representation. Use x.re to statically enforce Cartesian representation.

  alias getIm;
    Gets the imaginary component of the number. Might involve a calculation, subject to representation. Use x.im to statically enforce Cartesian representation.

  alias getModulus;
    Gets the modulus of the number. Might involve a calculation, subject to representation. Use x.modulus to statically enforce polar representation.

  alias getAngle;
    Gets the angle of the number. Might involve a calculation, subject to representation. Use x.angle to statically enforce polar representation.

Copyright Andrei Alexandrescu 2008 - 2009. | Page generated by Ddoc.