Average Error: 27.1 → 23.3
Time: 16.9s
Precision: 64
\[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.8805809533531431 \cdot 10^{184}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le 1.30644989599949 \cdot 10^{88}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot a - y \cdot b\right)}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}\]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\begin{array}{l}
\mathbf{if}\;a \le -1.8805809533531431 \cdot 10^{184}:\\
\;\;\;\;a\\

\mathbf{elif}\;a \le 1.30644989599949 \cdot 10^{88}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot a - y \cdot b\right)}{\left(x + t\right) + y}\\

\mathbf{else}:\\
\;\;\;\;a\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r1050302 = x;
        double r1050303 = y;
        double r1050304 = r1050302 + r1050303;
        double r1050305 = z;
        double r1050306 = r1050304 * r1050305;
        double r1050307 = t;
        double r1050308 = r1050307 + r1050303;
        double r1050309 = a;
        double r1050310 = r1050308 * r1050309;
        double r1050311 = r1050306 + r1050310;
        double r1050312 = b;
        double r1050313 = r1050303 * r1050312;
        double r1050314 = r1050311 - r1050313;
        double r1050315 = r1050302 + r1050307;
        double r1050316 = r1050315 + r1050303;
        double r1050317 = r1050314 / r1050316;
        return r1050317;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1050318 = a;
        double r1050319 = -1.880580953353143e+184;
        bool r1050320 = r1050318 <= r1050319;
        double r1050321 = 1.3064498959994905e+88;
        bool r1050322 = r1050318 <= r1050321;
        double r1050323 = x;
        double r1050324 = y;
        double r1050325 = r1050323 + r1050324;
        double r1050326 = z;
        double r1050327 = r1050325 * r1050326;
        double r1050328 = t;
        double r1050329 = r1050328 + r1050324;
        double r1050330 = r1050329 * r1050318;
        double r1050331 = b;
        double r1050332 = r1050324 * r1050331;
        double r1050333 = r1050330 - r1050332;
        double r1050334 = r1050327 + r1050333;
        double r1050335 = r1050323 + r1050328;
        double r1050336 = r1050335 + r1050324;
        double r1050337 = r1050334 / r1050336;
        double r1050338 = r1050322 ? r1050337 : r1050318;
        double r1050339 = r1050320 ? r1050318 : r1050338;
        return r1050339;
}

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

Original27.1
Target11.5
Herbie23.3
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt -3.5813117084150564 \cdot 10^{153}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt 1.2285964308315609 \cdot 10^{82}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -1.880580953353143e+184 or 1.3064498959994905e+88 < a

    1. Initial program 42.3

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Taylor expanded around 0 28.6

      \[\leadsto \color{blue}{a}\]

    if -1.880580953353143e+184 < a < 1.3064498959994905e+88

    1. Initial program 21.3

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied div-inv21.3

      \[\leadsto \color{blue}{\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-*r/21.3

      \[\leadsto \color{blue}{\frac{\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right) \cdot 1}{\left(x + t\right) + y}}\]
    6. Simplified21.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.8805809533531431 \cdot 10^{184}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le 1.30644989599949 \cdot 10^{88}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot a - y \cdot b\right)}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :herbie-target
  (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))

  (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))