Average Error: 2.1 → 2.7
Time: 5.9s
Precision: 64
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)\]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\left(x + y \cdot z\right) + a \cdot \left(z \cdot b + t\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r624419 = x;
        double r624420 = y;
        double r624421 = z;
        double r624422 = r624420 * r624421;
        double r624423 = r624419 + r624422;
        double r624424 = t;
        double r624425 = a;
        double r624426 = r624424 * r624425;
        double r624427 = r624423 + r624426;
        double r624428 = r624425 * r624421;
        double r624429 = b;
        double r624430 = r624428 * r624429;
        double r624431 = r624427 + r624430;
        return r624431;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r624432 = x;
        double r624433 = y;
        double r624434 = z;
        double r624435 = r624433 * r624434;
        double r624436 = r624432 + r624435;
        double r624437 = a;
        double r624438 = b;
        double r624439 = r624434 * r624438;
        double r624440 = t;
        double r624441 = r624439 + r624440;
        double r624442 = r624437 * r624441;
        double r624443 = r624436 + r624442;
        return r624443;
}

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.4
Herbie2.7
\[\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 < -4.53934499841231e-29 or 6.324662990263947e+118 < a

    1. Initial program 5.6

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-+l+5.6

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

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

    if -4.53934499841231e-29 < a < 6.324662990263947e+118

    1. Initial program 0.6

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

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

Reproduce

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