X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fparanoidnumber.h;h=9005a15d924c56257c82d377e8561676df6706bc;hp=f767ffa2a65315788be14b6d4a1baf4ba6527b95;hb=888817a67a9d840be66b52811b01eb77f10ff3e6;hpb=20788af97c06b76040ea2de5ab3ddc683a261365 diff --git a/src/paranoidnumber.h b/src/paranoidnumber.h index f767ffa..9005a15 100644 --- a/src/paranoidnumber.h +++ b/src/paranoidnumber.h @@ -8,7 +8,7 @@ #include "log.h" #include -#define PARANOID_DIGIT_T int8_t // we could theoretically replace this with a template +#define PARANOID_DIGIT_T float // we could theoretically replace this with a template // but let's not do that... namespace IPDF @@ -42,6 +42,7 @@ namespace IPDF T a(aa); T b(bb); T c(cc); T d(dd); if (aop == MULTIPLY && cop == MULTIPLY) // a*b + c*d { + if ((ParanoidOp(c, b, DIVIDE) || ParanoidOp(d, b, DIVIDE)) && TrustingOp(c, d, MULTIPLY) && TrustingOp(a,c,ADD) && TrustingOp(a, b, MULTIPLY)) // (a + (cd)/b) * b @@ -66,6 +67,8 @@ namespace IPDF } else if (aop == DIVIDE && cop == DIVIDE) { + + if (TrustingOp(a, d, MULTIPLY) && TrustingOp(c, b, MULTIPLY) && TrustingOp(a, c, ADD) && TrustingOp(b, d, MULTIPLY)) {