print rational numbers using the rdiv operator when defined (#413)

This commit is contained in:
Mark Thom
2020-04-28 18:03:04 -06:00
parent 8151b65d12
commit 0e1226573a
2 changed files with 79 additions and 1 deletions

View File

@@ -789,6 +789,13 @@ impl<'a> TryFrom<&'a HeapCellValue> for Number {
}
}
impl<'a> From<&'a Integer> for Number {
#[inline]
fn from(src: &'a Integer) -> Self {
Number::Integer(Rc::new(Integer::from(src)))
}
}
// Computes n ^ power. Ignores the sign of power.
pub fn binary_pow(mut n: Integer, power: &Integer) -> Integer {
let mut power = Integer::from(power.abs_ref());