Average Error: 2.0 → 2.6
Time: 11.1s
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 r502104 = x;
        double r502105 = y;
        double r502106 = z;
        double r502107 = r502105 * r502106;
        double r502108 = r502104 + r502107;
        double r502109 = t;
        double r502110 = a;
        double r502111 = r502109 * r502110;
        double r502112 = r502108 + r502111;
        double r502113 = r502110 * r502106;
        double r502114 = b;
        double r502115 = r502113 * r502114;
        double r502116 = r502112 + r502115;
        return r502116;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r502117 = y;
        double r502118 = z;
        double r502119 = r502117 * r502118;
        double r502120 = x;
        double r502121 = a;
        double r502122 = t;
        double r502123 = b;
        double r502124 = r502118 * r502123;
        double r502125 = r502122 + r502124;
        double r502126 = r502121 * r502125;
        double r502127 = r502120 + r502126;
        double r502128 = r502119 + r502127;
        return r502128;
}

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.0
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 a < 1.6907618451066415e-35

    1. Initial program 1.4

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.5

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot \color{blue}{\left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}\right)}\]
    4. Applied associate-*r*1.5

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

    if 1.6907618451066415e-35 < a

    1. Initial program 4.1

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

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

Reproduce

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