Average Error: 2.3 → 0.9
Time: 5.3s
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 -4.035514617533359053304326262914735101941 \cdot 10^{-85} \lor \neg \left(b \le 1.66963206289420839225539623091866545351 \cdot 10^{-233}\right):\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\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 -4.035514617533359053304326262914735101941 \cdot 10^{-85} \lor \neg \left(b \le 1.66963206289420839225539623091866545351 \cdot 10^{-233}\right):\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r595133 = x;
        double r595134 = y;
        double r595135 = z;
        double r595136 = r595134 * r595135;
        double r595137 = r595133 + r595136;
        double r595138 = t;
        double r595139 = a;
        double r595140 = r595138 * r595139;
        double r595141 = r595137 + r595140;
        double r595142 = r595139 * r595135;
        double r595143 = b;
        double r595144 = r595142 * r595143;
        double r595145 = r595141 + r595144;
        return r595145;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r595146 = b;
        double r595147 = -4.035514617533359e-85;
        bool r595148 = r595146 <= r595147;
        double r595149 = 1.6696320628942084e-233;
        bool r595150 = r595146 <= r595149;
        double r595151 = !r595150;
        bool r595152 = r595148 || r595151;
        double r595153 = x;
        double r595154 = y;
        double r595155 = z;
        double r595156 = r595154 * r595155;
        double r595157 = r595153 + r595156;
        double r595158 = t;
        double r595159 = a;
        double r595160 = r595158 * r595159;
        double r595161 = r595157 + r595160;
        double r595162 = r595159 * r595155;
        double r595163 = r595162 * r595146;
        double r595164 = r595161 + r595163;
        double r595165 = r595155 * r595146;
        double r595166 = r595158 + r595165;
        double r595167 = r595159 * r595166;
        double r595168 = r595153 + r595167;
        double r595169 = r595156 + r595168;
        double r595170 = r595152 ? r595164 : r595169;
        return r595170;
}

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.3
Target0.3
Herbie0.9
\[\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 b < -4.035514617533359e-85 or 1.6696320628942084e-233 < b

    1. Initial program 1.3

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

    if -4.035514617533359e-85 < b < 1.6696320628942084e-233

    1. Initial program 4.9

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

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

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

Reproduce

herbie shell --seed 2019322 
(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.75897431883642871e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

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