Average Error: 6.3 → 4.6
Time: 44.4s
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 r4146150 = c;
        double r4146151 = a;
        double r4146152 = b;
        double r4146153 = r4146151 * r4146152;
        double r4146154 = r4146150 - r4146153;
        double r4146155 = r4146154 * r4146154;
        double r4146156 = 1.0;
        double r4146157 = r4146151 * r4146151;
        double r4146158 = r4146156 - r4146157;
        double r4146159 = d;
        double r4146160 = r4146152 * r4146152;
        double r4146161 = r4146159 - r4146160;
        double r4146162 = R;
        double r4146163 = r4146162 * r4146162;
        double r4146164 = r4146161 - r4146163;
        double r4146165 = r4146158 * r4146164;
        double r4146166 = r4146155 - r4146165;
        return r4146166;
}

double f(double c, double a, double b, double d, double R) {
        double r4146167 = a;
        double r4146168 = d;
        double r4146169 = R;
        double r4146170 = r4146169 * r4146169;
        double r4146171 = r4146168 - r4146170;
        double r4146172 = r4146167 * r4146171;
        double r4146173 = r4146172 * r4146167;
        double r4146174 = c;
        double r4146175 = b;
        double r4146176 = r4146175 * r4146167;
        double r4146177 = r4146174 - r4146176;
        double r4146178 = r4146177 * r4146177;
        double r4146179 = r4146175 * r4146175;
        double r4146180 = r4146167 * r4146179;
        double r4146181 = -r4146180;
        double r4146182 = r4146167 * r4146181;
        double r4146183 = r4146171 - r4146179;
        double r4146184 = r4146182 - r4146183;
        double r4146185 = r4146178 + r4146184;
        double r4146186 = r4146173 + r4146185;
        return r4146186;
}

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-rgt-in5.0

    \[\leadsto \left(\color{blue}{\left(\left(a \cdot \left(d - R \cdot R\right)\right) \cdot a + \left(a \cdot \left(-b \cdot b\right)\right) \cdot a\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(\left(a \cdot \left(d - R \cdot R\right)\right) \cdot a + \left(\left(a \cdot \left(-b \cdot b\right)\right) \cdot a - \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}{\left(a \cdot \left(d - R \cdot R\right)\right) \cdot a + \left(\left(\left(a \cdot \left(-b \cdot b\right)\right) \cdot a - \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)))))