Struct __mpq_struct

Source
#[repr(C)]
pub struct __mpq_struct { pub _mp_num: __mpz_struct, pub _mp_den: __mpz_struct, }
Expand description

__mpq_struct

Fields§

§_mp_num: __mpz_struct

_mp_num

§_mp_den: __mpz_struct

_mp_den

Implementations§

Source§

impl __mpq_struct

impl mpq_s

Source

pub fn clear(&mut self)

clear

Source

pub fn init() -> Self

init create new instance

Source

pub fn set(&mut self, q: mpq_r<'_>) -> &mut Self

set self = q

Source

pub fn set_ui(&mut self, u: ui_t, f: ui_t) -> &mut Self

set_ui self = u

Source

pub fn set_si(&mut self, s: si_t, f: ui_t) -> &mut Self

set_si self = s

Source

pub fn set_d(&mut self, d: double_t) -> &mut Self

set_d self = d

Source

pub fn set_z(&mut self, a: mpz_r<'_>) -> &mut Self

set_z self = a

Source

pub fn set_f(&mut self, f: mpf_r<'_>) -> &mut Self

set_f self = f

Source

pub fn set_num(&mut self, num: mpz_r<'_>) -> &mut Self

set_num

Source

pub fn set_den(&mut self, den: mpz_r<'_>) -> &mut Self

set_den

Source

pub fn set_str(&mut self, s: &str, b: int_t) -> &mut Self

set_str self from str

Source

pub fn fmtstr(&self, b: int_t) -> String

fmtstr

Source

pub fn get_d(&self) -> double_t

get_d (loss of digits)

Source

pub fn get_num(&self) -> mpz_s

get_num create new instance of mpz_s

Source

pub fn get_den(&self) -> mpz_s

get_den create new instance of mpz_s

Source

pub fn numref(&self) -> mpz_r<'_>

numref

Source

pub fn denref(&self) -> mpz_r<'_>

denref

Source

pub fn swap(&mut self, r: mpq_t<'_>) -> &mut Self

swap

Source

pub fn cmp(&self, r: mpq_r<'_>) -> int_t

cmp

Source

pub fn cmp_z(&self, a: mpz_r<'_>) -> int_t

cmp_z

Source

pub fn cmp_ui(&self, u: ui_t) -> int_t

cmp_ui

Source

pub fn cmp_si(&self, s: si_t) -> int_t

cmp_si

Source

pub fn equal(&self, r: mpq_r<'_>) -> bool

equal

Source

pub fn sgn(&self) -> int_t

sgn

Source

pub fn inv(&self) -> Self

inv q**-1 create new instance

Source

pub fn abs(&self) -> Self

abs create new instance

Source

pub fn neg(&self) -> Self

neg create new instance

Source

pub fn sub(&mut self, r: mpq_r<'_>) -> &mut Self

sub self -= r

Source

pub fn add(&mut self, r: mpq_r<'_>) -> &mut Self

add self += r

Source

pub fn mul(&mut self, r: mpq_r<'_>) -> &mut Self

mul self *= r

Source

pub fn mul_2exp(&mut self, n: mp_bitcnt_t) -> &mut Self

mul_2exp self *= 2**n

Source

pub fn div(&mut self, r: mpq_r<'_>) -> &mut Self

div self /= r

Source

pub fn div_2exp(&mut self, n: mp_bitcnt_t) -> &mut Self

div_2exp self /= 2**n

Trait Implementations§

Source§

impl<'a, 'b> Add<&'b __mpq_struct> for &'a mpq_s

impl Add for mpq_r

Source§

fn add(self, rhs: &'b mpq_s) -> <mpq_s as Add<mpq_s>>::Output

add mpq_r + mpq_r

Source§

type Output = <__mpq_struct as Add>::Output

The resulting type after applying the + operator.
Source§

impl<'a> Add<&'a __mpq_struct> for mpq_s

impl ‘$imp’<‘&$u’$gt; for ‘$t’

Source§

fn add(self, rhs: &'a mpq_s) -> <mpq_s as Add<mpq_s>>::Output

‘$imp’ ‘$t’ ‘&$u’

Source§

type Output = <__mpq_struct as Add>::Output

The resulting type after applying the + operator.
Source§

impl<'a, 'b> Add<&'b mut __mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘&mut $u’$gt; for ‘&mut $t’

Source§

fn add(self, rhs: &'b mut mpq_s) -> <mpq_s as Add<mpq_s>>::Output

‘$imp’ ‘&mut $t’ ‘&mut $u’

Source§

type Output = <__mpq_struct as Add>::Output

The resulting type after applying the + operator.
Source§

impl<'a> Add<__mpq_struct> for &'a mpq_s

impl ‘$imp’<‘$u’$gt; for ‘&$t’

Source§

fn add(self, rhs: mpq_s) -> <mpq_s as Add<mpq_s>>::Output

‘$imp’ ‘&$t’ ‘$u’

Source§

type Output = <__mpq_struct as Add>::Output

The resulting type after applying the + operator.
Source§

impl<'a> AddAssign<&'a __mpq_struct> for mpq_s

impl AddAssign for mpq_s

Source§

fn add_assign(&mut self, rhs: &'a Self)

add_assign mpq_s += mpq_r

Source§

impl<'a> AddAssign<__mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘$u’> for &mut ‘$t’

Source§

fn add_assign(&mut self, rhs: mpq_s)

‘$imp’ &mut ‘$t’ ‘$u’

Source§

impl Debug for __mpq_struct

impl Debug

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

fmt

Source§

impl Display for __mpq_struct

impl Display

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

fmt

Source§

impl<'a, 'b> Div<&'b __mpq_struct> for &'a mpq_s

impl Div for mpq_r

Source§

fn div(self, rhs: &'b mpq_s) -> <mpq_s as Div<mpq_s>>::Output

div mpq_r / mpq_r

Source§

type Output = <__mpq_struct as Div>::Output

The resulting type after applying the / operator.
Source§

impl<'a> Div<&'a __mpq_struct> for mpq_s

impl ‘$imp’<‘&$u’$gt; for ‘$t’

Source§

fn div(self, rhs: &'a mpq_s) -> <mpq_s as Div<mpq_s>>::Output

‘$imp’ ‘$t’ ‘&$u’

Source§

type Output = <__mpq_struct as Div>::Output

The resulting type after applying the / operator.
Source§

impl<'a, 'b> Div<&'b mut __mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘&mut $u’$gt; for ‘&mut $t’

Source§

fn div(self, rhs: &'b mut mpq_s) -> <mpq_s as Div<mpq_s>>::Output

‘$imp’ ‘&mut $t’ ‘&mut $u’

Source§

type Output = <__mpq_struct as Div>::Output

The resulting type after applying the / operator.
Source§

impl<'a> Div<__mpq_struct> for &'a mpq_s

impl ‘$imp’<‘$u’$gt; for ‘&$t’

Source§

fn div(self, rhs: mpq_s) -> <mpq_s as Div<mpq_s>>::Output

‘$imp’ ‘&$t’ ‘$u’

Source§

type Output = <__mpq_struct as Div>::Output

The resulting type after applying the / operator.
Source§

impl<'a> DivAssign<&'a __mpq_struct> for mpq_s

impl DivAssign for mpq_s

Source§

fn div_assign(&mut self, rhs: &'a Self)

div_assign mpq_s /= mpq_r

Source§

impl<'a> DivAssign<__mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘$u’> for &mut ‘$t’

Source§

fn div_assign(&mut self, rhs: mpq_s)

‘$imp’ &mut ‘$t’ ‘$u’

Source§

impl Drop for __mpq_struct

impl Drop

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, 'b> Mul<&'b __mpq_struct> for &'a mpq_s

impl Mul for mpq_r

Source§

fn mul(self, rhs: &'b mpq_s) -> <mpq_s as Mul<mpq_s>>::Output

mul mpq_r * mpq_r

Source§

type Output = <__mpq_struct as Mul>::Output

The resulting type after applying the * operator.
Source§

impl<'a> Mul<&'a __mpq_struct> for mpq_s

impl ‘$imp’<‘&$u’$gt; for ‘$t’

Source§

fn mul(self, rhs: &'a mpq_s) -> <mpq_s as Mul<mpq_s>>::Output

‘$imp’ ‘$t’ ‘&$u’

Source§

type Output = <__mpq_struct as Mul>::Output

The resulting type after applying the * operator.
Source§

impl<'a, 'b> Mul<&'b mut __mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘&mut $u’$gt; for ‘&mut $t’

Source§

fn mul(self, rhs: &'b mut mpq_s) -> <mpq_s as Mul<mpq_s>>::Output

‘$imp’ ‘&mut $t’ ‘&mut $u’

Source§

type Output = <__mpq_struct as Mul>::Output

The resulting type after applying the * operator.
Source§

impl<'a> Mul<__mpq_struct> for &'a mpq_s

impl ‘$imp’<‘$u’$gt; for ‘&$t’

Source§

fn mul(self, rhs: mpq_s) -> <mpq_s as Mul<mpq_s>>::Output

‘$imp’ ‘&$t’ ‘$u’

Source§

type Output = <__mpq_struct as Mul>::Output

The resulting type after applying the * operator.
Source§

impl<'a> MulAssign<&'a __mpq_struct> for mpq_s

impl MulAssign for mpq_s

Source§

fn mul_assign(&mut self, rhs: &'a Self)

mul_assign mpq_s *= mpq_r

Source§

impl<'a> MulAssign<__mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘$u’> for &mut ‘$t’

Source§

fn mul_assign(&mut self, rhs: mpq_s)

‘$imp’ &mut ‘$t’ ‘$u’

Source§

impl SNew for __mpq_struct

impl SNew

Source§

fn new() -> Self

new

Source§

fn as_ptr(&self) -> mp_r

as_ptr
Source§

fn as_ptr_mut(&mut self) -> mp_t

as_ptr_mut
Source§

impl<'a, 'b> Sub<&'b __mpq_struct> for &'a mpq_s

impl Sub for mpq_r

Source§

fn sub(self, rhs: &'b mpq_s) -> <mpq_s as Sub<mpq_s>>::Output

sub mpq_r - mpq_r

Source§

type Output = <__mpq_struct as Sub>::Output

The resulting type after applying the - operator.
Source§

impl<'a> Sub<&'a __mpq_struct> for mpq_s

impl ‘$imp’<‘&$u’$gt; for ‘$t’

Source§

fn sub(self, rhs: &'a mpq_s) -> <mpq_s as Sub<mpq_s>>::Output

‘$imp’ ‘$t’ ‘&$u’

Source§

type Output = <__mpq_struct as Sub>::Output

The resulting type after applying the - operator.
Source§

impl<'a, 'b> Sub<&'b mut __mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘&mut $u’$gt; for ‘&mut $t’

Source§

fn sub(self, rhs: &'b mut mpq_s) -> <mpq_s as Sub<mpq_s>>::Output

‘$imp’ ‘&mut $t’ ‘&mut $u’

Source§

type Output = <__mpq_struct as Sub>::Output

The resulting type after applying the - operator.
Source§

impl<'a> Sub<__mpq_struct> for &'a mpq_s

impl ‘$imp’<‘$u’$gt; for ‘&$t’

Source§

fn sub(self, rhs: mpq_s) -> <mpq_s as Sub<mpq_s>>::Output

‘$imp’ ‘&$t’ ‘$u’

Source§

type Output = <__mpq_struct as Sub>::Output

The resulting type after applying the - operator.
Source§

impl<'a> SubAssign<&'a __mpq_struct> for mpq_s

impl SubAssign for mpq_s

Source§

fn sub_assign(&mut self, rhs: &'a Self)

sub_assign mpq_s -= mpq_r

Source§

impl<'a> SubAssign<__mpq_struct> for &'a mut mpq_s

impl ‘$imp’<‘$u’> for &mut ‘$t’

Source§

fn sub_assign(&mut self, rhs: mpq_s)

‘$imp’ &mut ‘$t’ ‘$u’

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.