Import std.math.big.complex
std.math.big.complex
Complex: a complex number, Real + Imaginary times i, as two Doubles, and worked out as Python's cmath does: Arg is from -pi to pi, and Log, Sqrt, and Pow give the principal value, scaled near the largest Doubles and among the subnormals as cmath scales them, with C99's values at infinities. Like a Double's, its arithmetic never panics, and what has no value, like dividing by 0, has NaN parts. A Double on either side of an operator works too.
std/math/big/complex.fb
Types
Complex
struct
Public Struct Complex Implements Equatable, Hashable, Printable, Numeric, Defaultable
A complex number, of a real and an imaginary part, each a Double.
std/math/big/complex.fb, line 32
-
Its real part.
-
Its imaginary part.
-
The number that adding leaves alone: 0.
Doc from
std.core.interfaces.Numeric.Zero. -
The number that multiplying leaves alone: 1.
Doc from
std.core.interfaces.Numeric.One. -
The value to start from, like 0 for a number, "" for a String, or an empty collection.
-
The number of the
magnitude, at theanglein radians from the positive real axis, as cmath.rect gives it: an angle of 0 has a Real part of themagnitude, even an infinite one. -
"1+2i", "0-1.5i", or "-3+0i", the Imaginary part's sign always shown.
-
Its distance from 0.
-
Its angle from the positive real axis, from -pi to pi.
-
The same number with its imaginary part negated.
-
e to its power. A real number's is real, and one that a Double holds isn't infinite on the way, as e to past 709 would be.
-
Its natural logarithm: the log of its magnitude, and its Arg. Near a magnitude of 1, the log comes from log1p, which keeps the digits that log would lose; past a quarter of the largest Double, from half of it; and among the subnormals, from it scaled up by 2^53.
-
Its square root with a Real part 0 or more, and the Imaginary part's sign, scaled as cmath scales it, so the largest and the subnormal numbers keep their digits.
-
It to the power: anything to 0 is 1, and 0 to a power with a Real part above 0 and no Imaginary part is 0, but to any other power has NaN parts.
-
Whether
aandbare equal.Doc from
std.core.interfaces.Equatable.Operator==. -
Whether
aandbare equal. -
Whether
aandbare equal. -
Its hash, the same for values that are equal.
Doc from
std.core.interfaces.Hashable.Hash. -
aandbadded up.Doc from
std.core.interfaces.Numeric.Operator+. -
aplusb. -
aplusb. -
btaken away froma.Doc from
std.core.interfaces.Numeric.Operator-. -
aminusb. -
aminusb. -
aandbmultiplied together.Doc from
std.core.interfaces.Numeric.Operator*. -
atimesb. -
atimesb. -
Smith's division, which scales by the larger part of
b, so no product overflows on the way. -
adivided byb. -
adivided byb. -
To a whole power, by squaring, which can be below 0.
-
anegated.
Report an issue with this page or with FutureBlitz on GitHub.