Average Error: 2.3 → 0.4
Time: 3.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}\;b \le -3.4811803307635136 \cdot 10^{-31} \lor \neg \left(b \le 6.8081321927219058 \cdot 10^{68}\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 -3.4811803307635136 \cdot 10^{-31} \lor \neg \left(b \le 6.8081321927219058 \cdot 10^{68}\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 r663060 = x;
        double r663061 = y;
        double r663062 = z;
        double r663063 = r663061 * r663062;
        double r663064 = r663060 + r663063;
        double r663065 = t;
        double r663066 = a;
        double r663067 = r663065 * r663066;
        double r663068 = r663064 + r663067;
        double r663069 = r663066 * r663062;
        double r663070 = b;
        double r663071 = r663069 * r663070;
        double r663072 = r663068 + r663071;
        return r663072;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r663073 = b;
        double r663074 = -3.4811803307635136e-31;
        bool r663075 = r663073 <= r663074;
        double r663076 = 6.808132192721906e+68;
        bool r663077 = r663073 <= r663076;
        double r663078 = !r663077;
        bool r663079 = r663075 || r663078;
        double r663080 = x;
        double r663081 = y;
        double r663082 = z;
        double r663083 = r663081 * r663082;
        double r663084 = r663080 + r663083;
        double r663085 = t;
        double r663086 = a;
        double r663087 = r663085 * r663086;
        double r663088 = r663084 + r663087;
        double r663089 = r663086 * r663082;
        double r663090 = r663089 * r663073;
        double r663091 = r663088 + r663090;
        double r663092 = r663082 * r663073;
        double r663093 = r663085 + r663092;
        double r663094 = r663086 * r663093;
        double r663095 = r663080 + r663094;
        double r663096 = r663083 + r663095;
        double r663097 = r663079 ? r663091 : r663096;
        return r663097;
}

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.4
Herbie0.4
\[\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 < -3.4811803307635136e-31 or 6.808132192721906e+68 < b

    1. Initial program 0.7

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

    if -3.4811803307635136e-31 < b < 6.808132192721906e+68

    1. Initial program 3.4

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

      \[\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.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.4811803307635136 \cdot 10^{-31} \lor \neg \left(b \le 6.8081321927219058 \cdot 10^{68}\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 2020018 
(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)))