Skip to content

Commit 2045f2d

Browse files
committed
Add const I
1 parent 7ae5235 commit 2045f2d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ impl<T> Complex<T> {
104104
}
105105

106106
impl<T: Clone + Num> Complex<T> {
107-
/// Returns imaginary unit
107+
/// Returns the imaginary unit.
108+
///
109+
/// See also [`Complex::I`].
108110
#[inline]
109111
pub fn i() -> Self {
110112
Self::new(T::zero(), T::one())
@@ -1176,6 +1178,9 @@ impl<T: Clone + Num> Zero for Complex<T> {
11761178
impl<T: ConstOne + ConstZero> Complex<T> {
11771179
/// A constant `Complex` 1.
11781180
pub const ONE: Self = Self::new(T::ONE, T::ZERO);
1181+
1182+
/// A constant `Complex` _i_, the imaginary unit.
1183+
pub const I: Self = Self::new(T::ZERO, T::ONE);
11791184
}
11801185

11811186
impl<T: Clone + Num + ConstOne + ConstZero> ConstOne for Complex<T> {

0 commit comments

Comments
 (0)