mpir/ops/
mpq.rs

1//! mpq
2//!
3
4pub mod sub;
5pub mod add;
6pub mod mul;
7pub mod div;
8pub mod rem;
9pub mod cmp;
10
11use std::ops::{Neg};
12use crate::ops::onforward_ref_unop;
13// use std::ops::{Index, IndexMut};
14use crate::prim::{mpq::*};
15
16onforward_ref_unop!{impl Neg, neg for mpq_s}
17
18/// impl Neg for mpq_r
19impl<'a> Neg for &'a mpq_s {
20  type Output = <mpq_s as Neg>::Output;
21
22  /// neg mpq_r
23  #[inline]
24  fn neg(self) -> <mpq_s as Neg>::Output {
25    let mut t = mpq_s::init();
26    mpq_neg(&mut t, self);
27    t
28  }
29}