Average Error: 2.1 → 2.7
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 r504258 = x;
        double r504259 = y;
        double r504260 = z;
        double r504261 = r504259 * r504260;
        double r504262 = r504258 + r504261;
        double r504263 = t;
        double r504264 = a;
        double r504265 = r504263 * r504264;
        double r504266 = r504262 + r504265;
        double r504267 = r504264 * r504260;
        double r504268 = b;
        double r504269 = r504267 * r504268;
        double r504270 = r504266 + r504269;
        return r504270;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r504271 = y;
        double r504272 = z;
        double r504273 = r504271 * r504272;
        double r504274 = x;
        double r504275 = a;
        double r504276 = t;
        double r504277 = b;
        double r504278 = r504272 * r504277;
        double r504279 = r504276 + r504278;
        double r504280 = r504275 * r504279;
        double r504281 = r504274 + r504280;
        double r504282 = r504273 + r504281;
        return r504282;
}

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.3
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 < 8.337622131960741e-150

    1. Initial program 1.8

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

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

    if 8.337622131960741e-150 < a

    1. Initial program 2.9

      \[\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*1.3

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{a \cdot \left(z \cdot b\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.7

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

Reproduce

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