Average Error: 2.0 → 0.5
Time: 15.5s
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}\;a \le -2.711362632576514974545306133803088111513 \cdot 10^{101}:\\ \;\;\;\;\left(x + y \cdot z\right) + \left(t + b \cdot z\right) \cdot a\\ \mathbf{elif}\;a \le 1.389488629724143166693422139504604657007 \cdot 10^{-73}:\\ \;\;\;\;a \cdot t + \left(z \cdot \left(y + a \cdot b\right) + x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot z\right) + \left(t + b \cdot z\right) \cdot a\\ \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}\;a \le -2.711362632576514974545306133803088111513 \cdot 10^{101}:\\
\;\;\;\;\left(x + y \cdot z\right) + \left(t + b \cdot z\right) \cdot a\\

\mathbf{elif}\;a \le 1.389488629724143166693422139504604657007 \cdot 10^{-73}:\\
\;\;\;\;a \cdot t + \left(z \cdot \left(y + a \cdot b\right) + x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r30266491 = x;
        double r30266492 = y;
        double r30266493 = z;
        double r30266494 = r30266492 * r30266493;
        double r30266495 = r30266491 + r30266494;
        double r30266496 = t;
        double r30266497 = a;
        double r30266498 = r30266496 * r30266497;
        double r30266499 = r30266495 + r30266498;
        double r30266500 = r30266497 * r30266493;
        double r30266501 = b;
        double r30266502 = r30266500 * r30266501;
        double r30266503 = r30266499 + r30266502;
        return r30266503;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r30266504 = a;
        double r30266505 = -2.711362632576515e+101;
        bool r30266506 = r30266504 <= r30266505;
        double r30266507 = x;
        double r30266508 = y;
        double r30266509 = z;
        double r30266510 = r30266508 * r30266509;
        double r30266511 = r30266507 + r30266510;
        double r30266512 = t;
        double r30266513 = b;
        double r30266514 = r30266513 * r30266509;
        double r30266515 = r30266512 + r30266514;
        double r30266516 = r30266515 * r30266504;
        double r30266517 = r30266511 + r30266516;
        double r30266518 = 1.3894886297241432e-73;
        bool r30266519 = r30266504 <= r30266518;
        double r30266520 = r30266504 * r30266512;
        double r30266521 = r30266504 * r30266513;
        double r30266522 = r30266508 + r30266521;
        double r30266523 = r30266509 * r30266522;
        double r30266524 = r30266523 + r30266507;
        double r30266525 = r30266520 + r30266524;
        double r30266526 = r30266519 ? r30266525 : r30266517;
        double r30266527 = r30266506 ? r30266517 : r30266526;
        return r30266527;
}

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.0
Target0.4
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;z \lt -11820553527347888128:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.758974318836428710669076838657752600596 \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 a < -2.711362632576515e+101 or 1.3894886297241432e-73 < a

    1. Initial program 4.5

      \[\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+4.5

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

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

    if -2.711362632576515e+101 < a < 1.3894886297241432e-73

    1. Initial program 0.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+0.6

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

      \[\leadsto \left(x + y \cdot z\right) + \color{blue}{a \cdot \left(b \cdot z + t\right)}\]
    5. Using strategy rm
    6. Applied distribute-lft-in4.1

      \[\leadsto \left(x + y \cdot z\right) + \color{blue}{\left(a \cdot \left(b \cdot z\right) + a \cdot t\right)}\]
    7. Applied associate-+r+4.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.711362632576514974545306133803088111513 \cdot 10^{101}:\\ \;\;\;\;\left(x + y \cdot z\right) + \left(t + b \cdot z\right) \cdot a\\ \mathbf{elif}\;a \le 1.389488629724143166693422139504604657007 \cdot 10^{-73}:\\ \;\;\;\;a \cdot t + \left(z \cdot \left(y + a \cdot b\right) + x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot z\right) + \left(t + b \cdot z\right) \cdot a\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< z -1.1820553527347888e+19) (+ (* 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)))