Average Error: 2.1 → 1.6
Time: 5.2s
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 5.0210463174598584 \cdot 10^{-42}:\\ \;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \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 5.0210463174598584 \cdot 10^{-42}:\\
\;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r809653 = x;
        double r809654 = y;
        double r809655 = z;
        double r809656 = r809654 * r809655;
        double r809657 = r809653 + r809656;
        double r809658 = t;
        double r809659 = a;
        double r809660 = r809658 * r809659;
        double r809661 = r809657 + r809660;
        double r809662 = r809659 * r809655;
        double r809663 = b;
        double r809664 = r809662 * r809663;
        double r809665 = r809661 + r809664;
        return r809665;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r809666 = b;
        double r809667 = 5.0210463174598584e-42;
        bool r809668 = r809666 <= r809667;
        double r809669 = y;
        double r809670 = z;
        double r809671 = r809669 * r809670;
        double r809672 = x;
        double r809673 = a;
        double r809674 = t;
        double r809675 = r809670 * r809666;
        double r809676 = r809674 + r809675;
        double r809677 = r809673 * r809676;
        double r809678 = r809672 + r809677;
        double r809679 = r809671 + r809678;
        double r809680 = r809672 + r809671;
        double r809681 = r809674 * r809673;
        double r809682 = r809680 + r809681;
        double r809683 = r809673 * r809670;
        double r809684 = r809683 * r809666;
        double r809685 = r809682 + r809684;
        double r809686 = r809668 ? r809679 : r809685;
        return r809686;
}

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.1
Target0.3
Herbie1.6
\[\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 < 5.0210463174598584e-42

    1. Initial program 2.6

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Simplified1.8

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

    if 5.0210463174598584e-42 < b

    1. Initial program 0.7

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.6

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

Reproduce

herbie shell --seed 2020035 
(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)))