Average Error: 2.2 → 0.6
Time: 4.8s
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 -1.273932173214477057730693817092682574417 \cdot 10^{100} \lor \neg \left(a \le 1.243496909209019393497569014876585765327 \cdot 10^{-118} \lor \neg \left(a \le 3.574603319696684885102771900736830859238 \cdot 10^{304}\right)\right):\\ \;\;\;\;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}\;a \le -1.273932173214477057730693817092682574417 \cdot 10^{100} \lor \neg \left(a \le 1.243496909209019393497569014876585765327 \cdot 10^{-118} \lor \neg \left(a \le 3.574603319696684885102771900736830859238 \cdot 10^{304}\right)\right):\\
\;\;\;\;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 r628145 = x;
        double r628146 = y;
        double r628147 = z;
        double r628148 = r628146 * r628147;
        double r628149 = r628145 + r628148;
        double r628150 = t;
        double r628151 = a;
        double r628152 = r628150 * r628151;
        double r628153 = r628149 + r628152;
        double r628154 = r628151 * r628147;
        double r628155 = b;
        double r628156 = r628154 * r628155;
        double r628157 = r628153 + r628156;
        return r628157;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r628158 = a;
        double r628159 = -1.273932173214477e+100;
        bool r628160 = r628158 <= r628159;
        double r628161 = 1.2434969092090194e-118;
        bool r628162 = r628158 <= r628161;
        double r628163 = 3.574603319696685e+304;
        bool r628164 = r628158 <= r628163;
        double r628165 = !r628164;
        bool r628166 = r628162 || r628165;
        double r628167 = !r628166;
        bool r628168 = r628160 || r628167;
        double r628169 = y;
        double r628170 = z;
        double r628171 = r628169 * r628170;
        double r628172 = x;
        double r628173 = t;
        double r628174 = b;
        double r628175 = r628170 * r628174;
        double r628176 = r628173 + r628175;
        double r628177 = r628158 * r628176;
        double r628178 = r628172 + r628177;
        double r628179 = r628171 + r628178;
        double r628180 = r628172 + r628171;
        double r628181 = r628173 * r628158;
        double r628182 = r628180 + r628181;
        double r628183 = r628158 * r628170;
        double r628184 = r628183 * r628174;
        double r628185 = r628182 + r628184;
        double r628186 = r628168 ? r628179 : r628185;
        return r628186;
}

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.6
\[\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 < -1.273932173214477e+100 or 1.2434969092090194e-118 < a < 3.574603319696685e+304

    1. Initial program 4.5

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

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

    if -1.273932173214477e+100 < a < 1.2434969092090194e-118 or 3.574603319696685e+304 < a

    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 simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.273932173214477057730693817092682574417 \cdot 10^{100} \lor \neg \left(a \le 1.243496909209019393497569014876585765327 \cdot 10^{-118} \lor \neg \left(a \le 3.574603319696684885102771900736830859238 \cdot 10^{304}\right)\right):\\ \;\;\;\;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 2019353 
(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)))