From c201a1a626cb059da169fcff67aefedb7bccd846 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 29 Nov 2023 21:21:10 -0800 Subject: [PATCH] improve zeroes precision --- src/zeroes.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/zeroes.rs b/src/zeroes.rs index f681a2db..d75581fa 100644 --- a/src/zeroes.rs +++ b/src/zeroes.rs @@ -11,10 +11,12 @@ pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64) -> Vec{ //start with f64 sqrt let planar_radicand=Planar64::raw(unsafe{(radicand as f64).sqrt().to_int_unchecked()}); //TODO: one or two newtons - if Planar64::ZEROvec![(-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)];