Average Error: 6.3 → 4.6
Time: 45.8s
Precision: 64
\[\left(c - a \cdot b\right) \cdot \left(c - a \cdot b\right) - \left(1 - a \cdot a\right) \cdot \left(\left(d - b \cdot b\right) - R \cdot R\right)\]
\[\left(a \cdot \left(d - R \cdot R\right)\right) \cdot a + \left(\left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right) + \left(a \cdot \left(-a \cdot \left(b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right)\right)\]
\left(c - a \cdot b\right) \cdot \left(c - a \cdot b\right) - \left(1 - a \cdot a\right) \cdot \left(\left(d - b \cdot b\right) - R \cdot R\right)
\left(a \cdot \left(d - R \cdot R\right)\right) \cdot a + \left(\left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right) + \left(a \cdot \left(-a \cdot \left(b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right)\right)
double f(double c, double a, double b, double d, double R) {
        double r6160741 = c;
        double r6160742 = a;
        double r6160743 = b;
        double r6160744 = r6160742 * r6160743;
        double r6160745 = r6160741 - r6160744;
        double r6160746 = r6160745 * r6160745;
        double r6160747 = 1.0;
        double r6160748 = r6160742 * r6160742;
        double r6160749 = r6160747 - r6160748;
        double r6160750 = d;
        double r6160751 = r6160743 * r6160743;
        double r6160752 = r6160750 - r6160751;
        double r6160753 = R;
        double r6160754 = r6160753 * r6160753;
        double r6160755 = r6160752 - r6160754;
        double r6160756 = r6160749 * r6160755;
        double r6160757 = r6160746 - r6160756;
        return r6160757;
}

double f(double c, double a, double b, double d, double R) {
        double r6160758 = a;
        double r6160759 = d;
        double r6160760 = R;
        double r6160761 = r6160760 * r6160760;
        double r6160762 = r6160759 - r6160761;
        double r6160763 = r6160758 * r6160762;
        double r6160764 = r6160763 * r6160758;
        double r6160765 = c;
        double r6160766 = b;
        double r6160767 = r6160766 * r6160758;
        double r6160768 = r6160765 - r6160767;
        double r6160769 = r6160768 * r6160768;
        double r6160770 = r6160766 * r6160766;
        double r6160771 = r6160758 * r6160770;
        double r6160772 = -r6160771;
        double r6160773 = r6160758 * r6160772;
        double r6160774 = r6160762 - r6160770;
        double r6160775 = r6160773 - r6160774;
        double r6160776 = r6160769 + r6160775;
        double r6160777 = r6160764 + r6160776;
        return r6160777;
}

Error

Bits error versus c

Bits error versus a

Bits error versus b

Bits error versus d

Bits error versus R

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 6.3

    \[\left(c - a \cdot b\right) \cdot \left(c - a \cdot b\right) - \left(1 - a \cdot a\right) \cdot \left(\left(d - b \cdot b\right) - R \cdot R\right)\]
  2. Simplified6.3

    \[\leadsto \color{blue}{\left(\left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)}\]
  3. Using strategy rm
  4. Applied associate-*l*5.0

    \[\leadsto \left(\color{blue}{a \cdot \left(a \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right)\right)} - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)\]
  5. Using strategy rm
  6. Applied sub-neg5.0

    \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(\left(d - R \cdot R\right) + \left(-b \cdot b\right)\right)}\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)\]
  7. Applied distribute-lft-in5.0

    \[\leadsto \left(a \cdot \color{blue}{\left(a \cdot \left(d - R \cdot R\right) + a \cdot \left(-b \cdot b\right)\right)} - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)\]
  8. Applied distribute-lft-in5.0

    \[\leadsto \left(\color{blue}{\left(a \cdot \left(a \cdot \left(d - R \cdot R\right)\right) + a \cdot \left(a \cdot \left(-b \cdot b\right)\right)\right)} - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)\]
  9. Applied associate--l+5.0

    \[\leadsto \color{blue}{\left(a \cdot \left(a \cdot \left(d - R \cdot R\right)\right) + \left(a \cdot \left(a \cdot \left(-b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right)\right)} + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)\]
  10. Applied associate-+l+4.6

    \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(d - R \cdot R\right)\right) + \left(\left(a \cdot \left(a \cdot \left(-b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) + \left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right)\right)}\]
  11. Final simplification4.6

    \[\leadsto \left(a \cdot \left(d - R \cdot R\right)\right) \cdot a + \left(\left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right) + \left(a \cdot \left(-a \cdot \left(b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\right)\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (c a b d R)
  :name "(c-a*b)*(c-a*b) - (1-a*a)*(d-b*b-R*R)"
  (- (* (- c (* a b)) (- c (* a b))) (* (- 1 (* a a)) (- (- d (* b b)) (* R R)))))