Average Error: 2.2 → 2.6
Time: 11.0s
Precision: 64
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\right)\]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
y \cdot z + \left(x + a \cdot \left(t + z \cdot b\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r565313 = x;
        double r565314 = y;
        double r565315 = z;
        double r565316 = r565314 * r565315;
        double r565317 = r565313 + r565316;
        double r565318 = t;
        double r565319 = a;
        double r565320 = r565318 * r565319;
        double r565321 = r565317 + r565320;
        double r565322 = r565319 * r565315;
        double r565323 = b;
        double r565324 = r565322 * r565323;
        double r565325 = r565321 + r565324;
        return r565325;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r565326 = y;
        double r565327 = z;
        double r565328 = r565326 * r565327;
        double r565329 = x;
        double r565330 = a;
        double r565331 = t;
        double r565332 = b;
        double r565333 = r565327 * r565332;
        double r565334 = r565331 + r565333;
        double r565335 = r565330 * r565334;
        double r565336 = r565329 + r565335;
        double r565337 = r565328 + r565336;
        return r565337;
}

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.4
Herbie2.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 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < -inf.0 or 5.1160194144789085e+293 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))

    1. Initial program 34.0

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

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

    if -inf.0 < (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) < 5.1160194144789085e+293

    1. Initial program 0.3

      \[\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 simplification2.6

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

Reproduce

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