pub struct LogosComplex(pub Complex);Expand description
An exact complex number re + im·i — the AOT mirror of the interpreter’s Complex.
complex(0, 1) compiles to LogosComplex::new(..); + − × ÷ stay exact and closed
(i·i = −1). NOT ordered. Display shows 3+4i / i / -2i, matching the interpreter.
Tuple Fields§
§0: ComplexImplementations§
Source§impl LogosComplex
impl LogosComplex
Sourcepub fn new(re: LogosRational, im: LogosRational) -> Self
pub fn new(re: LogosRational, im: LogosRational) -> Self
re + im·i from two exact rationals.
pub fn add(&self, other: &LogosComplex) -> LogosComplex
pub fn sub(&self, other: &LogosComplex) -> LogosComplex
pub fn mul(&self, other: &LogosComplex) -> LogosComplex
Sourcepub fn div_exact(&self, other: &LogosComplex) -> LogosComplex
pub fn div_exact(&self, other: &LogosComplex) -> LogosComplex
Exact division (the complex field is closed). Panics on a zero divisor, mirroring / 0.
Trait Implementations§
Source§impl Clone for LogosComplex
impl Clone for LogosComplex
Source§fn clone(&self) -> LogosComplex
fn clone(&self) -> LogosComplex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogosComplex
impl Debug for LogosComplex
Source§impl Display for LogosComplex
impl Display for LogosComplex
Source§impl From<i64> for LogosComplex
impl From<i64> for LogosComplex
Source§impl Hash for LogosComplex
impl Hash for LogosComplex
Source§impl PartialEq for LogosComplex
impl PartialEq for LogosComplex
Source§fn eq(&self, other: &LogosComplex) -> bool
fn eq(&self, other: &LogosComplex) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for LogosComplex
impl StructuralPartialEq for LogosComplex
Auto Trait Implementations§
impl Freeze for LogosComplex
impl RefUnwindSafe for LogosComplex
impl Send for LogosComplex
impl Sync for LogosComplex
impl Unpin for LogosComplex
impl UnsafeUnpin for LogosComplex
impl UnwindSafe for LogosComplex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.