//find roots of polynomials use crate::integer::Planar64; #[inline] pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64) -> Vec{ if a2==Planar64::ZERO{ return zeroes1(a0, a1); } let radicand=a1.get() as i128*a1.get() as i128-a2.get() as i128*a0.get() as i128*4; if 0vec![(-a1-planar_radicand)/(a2*2),(a0*2)/(-a1-planar_radicand)], (true, false)=>vec![(a0*2)/(-a1+planar_radicand),(-a1+planar_radicand)/(a2*2)], (false,true )=>vec![(a0*2)/(-a1-planar_radicand),(-a1-planar_radicand)/(a2*2)], (false,false)=>vec![(-a1+planar_radicand)/(a2*2),(a0*2)/(-a1+planar_radicand)], } } else if radicand==0 { return vec![a1/(a2*-2)]; } else { return vec![]; } } #[inline] pub fn zeroes1(a0:Planar64,a1:Planar64) -> Vec { if a1==Planar64::ZERO{ return vec![]; }else{ let q=((-a0.get() as i128)<<32)/(a1.get() as i128); if i64::MIN as i128<=q&&q<=i64::MAX as i128{ return vec![Planar64::raw(q as i64)]; }else{ return vec![]; } } }