mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-07 05:59:03 +01:00
Make LCM aware of Gaussian integers
This commit is contained in:
parent
7f0fee640d
commit
a1b7631735
@ -580,7 +580,9 @@ pub mod funcs {
|
||||
// ⎝ ⎠
|
||||
pub fn lcm(x: KalkNum, y: KalkNum) -> KalkNum {
|
||||
let gcd = gcd(x.clone(), y.clone());
|
||||
return abs(x).div_without_unit(gcd).mul_without_unit(y);
|
||||
let absx = KalkNum::new_with_imaginary(x.value.abs(), &x.unit, x.imaginary_value);
|
||||
let absy = KalkNum::new_with_imaginary(y.value.abs(), &y.unit, y.imaginary_value);
|
||||
return absx.div_without_unit(gcd).mul_without_unit(absy);
|
||||
}
|
||||
|
||||
pub fn log(x: KalkNum) -> KalkNum {
|
||||
|
Loading…
Reference in New Issue
Block a user