Average Error: 2.2 → 0.8
Time: 3.6s
Precision: 64
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;b \le -7.48864513222409 \cdot 10^{114} \lor \neg \left(b \le 7.3947572414712359 \cdot 10^{132}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)\\ \end{array}\]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
\mathbf{if}\;b \le -7.48864513222409 \cdot 10^{114} \lor \neg \left(b \le 7.3947572414712359 \cdot 10^{132}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r792470 = x;
        double r792471 = y;
        double r792472 = z;
        double r792473 = r792471 * r792472;
        double r792474 = r792470 + r792473;
        double r792475 = t;
        double r792476 = a;
        double r792477 = r792475 * r792476;
        double r792478 = r792474 + r792477;
        double r792479 = r792476 * r792472;
        double r792480 = b;
        double r792481 = r792479 * r792480;
        double r792482 = r792478 + r792481;
        return r792482;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r792483 = b;
        double r792484 = -7.48864513222409e+114;
        bool r792485 = r792483 <= r792484;
        double r792486 = 7.394757241471236e+132;
        bool r792487 = r792483 <= r792486;
        double r792488 = !r792487;
        bool r792489 = r792485 || r792488;
        double r792490 = x;
        double r792491 = y;
        double r792492 = z;
        double r792493 = r792491 * r792492;
        double r792494 = r792490 + r792493;
        double r792495 = t;
        double r792496 = a;
        double r792497 = r792495 * r792496;
        double r792498 = r792494 + r792497;
        double r792499 = r792496 * r792492;
        double r792500 = r792499 * r792483;
        double r792501 = r792498 + r792500;
        double r792502 = r792492 * r792483;
        double r792503 = r792502 + r792495;
        double r792504 = r792496 * r792503;
        double r792505 = r792494 + r792504;
        double r792506 = r792489 ? r792501 : r792505;
        return r792506;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.2
Target0.3
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;z \lt -11820553527347888000:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.75897431883642871 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if b < -7.48864513222409e+114 or 7.394757241471236e+132 < b

    1. Initial program 1.0

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]

    if -7.48864513222409e+114 < b < 7.394757241471236e+132

    1. Initial program 2.6

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-+l+2.6

      \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)}\]
    4. Simplified0.7

      \[\leadsto \left(x + y \cdot z\right) + \color{blue}{a \cdot \left(z \cdot b + t\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -7.48864513222409 \cdot 10^{114} \lor \neg \left(b \le 7.3947572414712359 \cdot 10^{132}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
  :precision binary64

  :herbie-target
  (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))