Average Error: 2.0 → 0.3
Time: 5.0s
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 -4.182130663845512951345323387709379248827 \cdot 10^{-50} \lor \neg \left(b \le 7.29542932636789967649720761385716259608 \cdot 10^{-25}\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 -4.182130663845512951345323387709379248827 \cdot 10^{-50} \lor \neg \left(b \le 7.29542932636789967649720761385716259608 \cdot 10^{-25}\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 r569074 = x;
        double r569075 = y;
        double r569076 = z;
        double r569077 = r569075 * r569076;
        double r569078 = r569074 + r569077;
        double r569079 = t;
        double r569080 = a;
        double r569081 = r569079 * r569080;
        double r569082 = r569078 + r569081;
        double r569083 = r569080 * r569076;
        double r569084 = b;
        double r569085 = r569083 * r569084;
        double r569086 = r569082 + r569085;
        return r569086;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r569087 = b;
        double r569088 = -4.182130663845513e-50;
        bool r569089 = r569087 <= r569088;
        double r569090 = 7.2954293263679e-25;
        bool r569091 = r569087 <= r569090;
        double r569092 = !r569091;
        bool r569093 = r569089 || r569092;
        double r569094 = x;
        double r569095 = y;
        double r569096 = z;
        double r569097 = r569095 * r569096;
        double r569098 = r569094 + r569097;
        double r569099 = t;
        double r569100 = a;
        double r569101 = r569099 * r569100;
        double r569102 = r569098 + r569101;
        double r569103 = r569100 * r569096;
        double r569104 = r569103 * r569087;
        double r569105 = r569102 + r569104;
        double r569106 = r569096 * r569087;
        double r569107 = r569099 + r569106;
        double r569108 = r569100 * r569107;
        double r569109 = r569094 + r569108;
        double r569110 = r569097 + r569109;
        double r569111 = r569093 ? r569105 : r569110;
        return r569111;
}

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.3
Herbie0.3
\[\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 b < -4.182130663845513e-50 or 7.2954293263679e-25 < b

    1. Initial program 0.6

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

    if -4.182130663845513e-50 < b < 7.2954293263679e-25

    1. Initial program 3.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.182130663845512951345323387709379248827 \cdot 10^{-50} \lor \neg \left(b \le 7.29542932636789967649720761385716259608 \cdot 10^{-25}\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 2020002 
(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)))