Average Error: 6.3 → 2.6
Time: 36.3s
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)\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.3641533612719124 \cdot 10^{+76}:\\ \;\;\;\;\left(\left(a \cdot \left(d \cdot a\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(R \cdot a\right) \cdot \left(R \cdot a\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\ \mathbf{elif}\;a \le 2.8497698901809797 \cdot 10^{+55}:\\ \;\;\;\;\left(\left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right) + \left(\left(c \cdot c + \left(a \cdot b\right) \cdot \left(a \cdot b\right)\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(a \cdot \left(d \cdot a\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(R \cdot a\right) \cdot \left(R \cdot a\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\ \end{array}\]
\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)
\begin{array}{l}
\mathbf{if}\;a \le -2.3641533612719124 \cdot 10^{+76}:\\
\;\;\;\;\left(\left(a \cdot \left(d \cdot a\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(R \cdot a\right) \cdot \left(R \cdot a\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\

\mathbf{elif}\;a \le 2.8497698901809797 \cdot 10^{+55}:\\
\;\;\;\;\left(\left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right) + \left(\left(c \cdot c + \left(a \cdot b\right) \cdot \left(a \cdot b\right)\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(a \cdot \left(d \cdot a\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(R \cdot a\right) \cdot \left(R \cdot a\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\

\end{array}
double f(double c, double a, double b, double d, double R) {
        double r22418249 = c;
        double r22418250 = a;
        double r22418251 = b;
        double r22418252 = r22418250 * r22418251;
        double r22418253 = r22418249 - r22418252;
        double r22418254 = r22418253 * r22418253;
        double r22418255 = 1.0;
        double r22418256 = r22418250 * r22418250;
        double r22418257 = r22418255 - r22418256;
        double r22418258 = d;
        double r22418259 = r22418251 * r22418251;
        double r22418260 = r22418258 - r22418259;
        double r22418261 = R;
        double r22418262 = r22418261 * r22418261;
        double r22418263 = r22418260 - r22418262;
        double r22418264 = r22418257 * r22418263;
        double r22418265 = r22418254 - r22418264;
        return r22418265;
}

double f(double c, double a, double b, double d, double R) {
        double r22418266 = a;
        double r22418267 = -2.3641533612719124e+76;
        bool r22418268 = r22418266 <= r22418267;
        double r22418269 = d;
        double r22418270 = r22418269 * r22418266;
        double r22418271 = r22418266 * r22418270;
        double r22418272 = 2.0;
        double r22418273 = c;
        double r22418274 = r22418272 * r22418273;
        double r22418275 = b;
        double r22418276 = r22418266 * r22418275;
        double r22418277 = r22418274 * r22418276;
        double r22418278 = r22418271 - r22418277;
        double r22418279 = R;
        double r22418280 = r22418279 * r22418266;
        double r22418281 = r22418280 * r22418280;
        double r22418282 = r22418278 - r22418281;
        double r22418283 = r22418279 * r22418279;
        double r22418284 = r22418269 - r22418283;
        double r22418285 = r22418275 * r22418275;
        double r22418286 = r22418284 - r22418285;
        double r22418287 = r22418282 - r22418286;
        double r22418288 = 2.8497698901809797e+55;
        bool r22418289 = r22418266 <= r22418288;
        double r22418290 = r22418266 * r22418266;
        double r22418291 = r22418290 * r22418286;
        double r22418292 = r22418273 * r22418273;
        double r22418293 = r22418276 * r22418276;
        double r22418294 = r22418292 + r22418293;
        double r22418295 = r22418294 - r22418277;
        double r22418296 = r22418291 + r22418295;
        double r22418297 = r22418296 - r22418286;
        double r22418298 = r22418289 ? r22418297 : r22418287;
        double r22418299 = r22418268 ? r22418287 : r22418298;
        return r22418299;
}

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. Split input into 2 regimes
  2. if a < -2.3641533612719124e+76 or 2.8497698901809797e+55 < a

    1. Initial program 32.1

      \[\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. Simplified31.6

      \[\leadsto \color{blue}{\left(\left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right) + \left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)}\]
    3. Taylor expanded around inf 23.9

      \[\leadsto \color{blue}{\left({a}^{2} \cdot d - \left(2 \cdot \left(a \cdot \left(b \cdot c\right)\right) + {a}^{2} \cdot {R}^{2}\right)\right)} - \left(\left(d - R \cdot R\right) - b \cdot b\right)\]
    4. Simplified8.0

      \[\leadsto \color{blue}{\left(\left(\left(a \cdot d\right) \cdot a - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(a \cdot R\right) \cdot \left(a \cdot R\right)\right)} - \left(\left(d - R \cdot R\right) - b \cdot b\right)\]

    if -2.3641533612719124e+76 < a < 2.8497698901809797e+55

    1. Initial program 2.2

      \[\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. Simplified1.7

      \[\leadsto \color{blue}{\left(\left(c - b \cdot a\right) \cdot \left(c - b \cdot a\right) + \left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)}\]
    3. Taylor expanded around -inf 1.2

      \[\leadsto \left(\color{blue}{\left(\left({a}^{2} \cdot {b}^{2} + {c}^{2}\right) - 2 \cdot \left(a \cdot \left(b \cdot c\right)\right)\right)} + \left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\]
    4. Simplified1.7

      \[\leadsto \left(\color{blue}{\left(\left(\left(a \cdot b\right) \cdot \left(a \cdot b\right) + c \cdot c\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right)} + \left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.3641533612719124 \cdot 10^{+76}:\\ \;\;\;\;\left(\left(a \cdot \left(d \cdot a\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(R \cdot a\right) \cdot \left(R \cdot a\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\ \mathbf{elif}\;a \le 2.8497698901809797 \cdot 10^{+55}:\\ \;\;\;\;\left(\left(a \cdot a\right) \cdot \left(\left(d - R \cdot R\right) - b \cdot b\right) + \left(\left(c \cdot c + \left(a \cdot b\right) \cdot \left(a \cdot b\right)\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(a \cdot \left(d \cdot a\right) - \left(2 \cdot c\right) \cdot \left(a \cdot b\right)\right) - \left(R \cdot a\right) \cdot \left(R \cdot a\right)\right) - \left(\left(d - R \cdot R\right) - b \cdot b\right)\\ \end{array}\]

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)))))