Average Error: 6.7 → 1.6
Time: 15.1s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.321316198184014864250290572846970188364 \cdot 10^{-37}:\\ \;\;\;\;x - \frac{x - y}{t} \cdot z\\ \mathbf{elif}\;z \le 1.565053397910881773034896102378336415142 \cdot 10^{83}:\\ \;\;\;\;x - \frac{\left(x - y\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(\left(x - y\right) \cdot \frac{\sqrt[3]{z}}{t}\right) \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \le -9.321316198184014864250290572846970188364 \cdot 10^{-37}:\\
\;\;\;\;x - \frac{x - y}{t} \cdot z\\

\mathbf{elif}\;z \le 1.565053397910881773034896102378336415142 \cdot 10^{83}:\\
\;\;\;\;x - \frac{\left(x - y\right) \cdot z}{t}\\

\mathbf{else}:\\
\;\;\;\;x - \left(\left(x - y\right) \cdot \frac{\sqrt[3]{z}}{t}\right) \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r146938 = x;
        double r146939 = y;
        double r146940 = r146939 - r146938;
        double r146941 = z;
        double r146942 = r146940 * r146941;
        double r146943 = t;
        double r146944 = r146942 / r146943;
        double r146945 = r146938 + r146944;
        return r146945;
}

double f(double x, double y, double z, double t) {
        double r146946 = z;
        double r146947 = -9.321316198184015e-37;
        bool r146948 = r146946 <= r146947;
        double r146949 = x;
        double r146950 = y;
        double r146951 = r146949 - r146950;
        double r146952 = t;
        double r146953 = r146951 / r146952;
        double r146954 = r146953 * r146946;
        double r146955 = r146949 - r146954;
        double r146956 = 1.5650533979108818e+83;
        bool r146957 = r146946 <= r146956;
        double r146958 = r146951 * r146946;
        double r146959 = r146958 / r146952;
        double r146960 = r146949 - r146959;
        double r146961 = cbrt(r146946);
        double r146962 = r146961 / r146952;
        double r146963 = r146951 * r146962;
        double r146964 = r146961 * r146961;
        double r146965 = r146963 * r146964;
        double r146966 = r146949 - r146965;
        double r146967 = r146957 ? r146960 : r146966;
        double r146968 = r146948 ? r146955 : r146967;
        return r146968;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.7
Target2.1
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;x \lt -9.025511195533004570453352523209034680317 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.275032163700714748507147332551979944314 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -9.321316198184015e-37

    1. Initial program 12.4

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Simplified2.6

      \[\leadsto \color{blue}{x - \frac{z}{t} \cdot \left(x - y\right)}\]
    3. Using strategy rm
    4. Applied div-inv2.7

      \[\leadsto x - \color{blue}{\left(z \cdot \frac{1}{t}\right)} \cdot \left(x - y\right)\]
    5. Applied associate-*l*1.6

      \[\leadsto x - \color{blue}{z \cdot \left(\frac{1}{t} \cdot \left(x - y\right)\right)}\]
    6. Simplified1.5

      \[\leadsto x - z \cdot \color{blue}{\frac{x - y}{t}}\]

    if -9.321316198184015e-37 < z < 1.5650533979108818e+83

    1. Initial program 1.5

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Simplified1.2

      \[\leadsto \color{blue}{x - \frac{z}{t} \cdot \left(x - y\right)}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity1.2

      \[\leadsto x - \color{blue}{\left(1 \cdot \frac{z}{t}\right)} \cdot \left(x - y\right)\]
    5. Applied associate-*l*1.2

      \[\leadsto x - \color{blue}{1 \cdot \left(\frac{z}{t} \cdot \left(x - y\right)\right)}\]
    6. Simplified1.5

      \[\leadsto x - 1 \cdot \color{blue}{\frac{z \cdot \left(x - y\right)}{t}}\]

    if 1.5650533979108818e+83 < z

    1. Initial program 21.6

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Simplified4.7

      \[\leadsto \color{blue}{x - \frac{z}{t} \cdot \left(x - y\right)}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity4.7

      \[\leadsto x - \frac{z}{\color{blue}{1 \cdot t}} \cdot \left(x - y\right)\]
    5. Applied add-cube-cbrt5.4

      \[\leadsto x - \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{1 \cdot t} \cdot \left(x - y\right)\]
    6. Applied times-frac5.4

      \[\leadsto x - \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \frac{\sqrt[3]{z}}{t}\right)} \cdot \left(x - y\right)\]
    7. Applied associate-*l*2.3

      \[\leadsto x - \color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \left(\frac{\sqrt[3]{z}}{t} \cdot \left(x - y\right)\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.321316198184014864250290572846970188364 \cdot 10^{-37}:\\ \;\;\;\;x - \frac{x - y}{t} \cdot z\\ \mathbf{elif}\;z \le 1.565053397910881773034896102378336415142 \cdot 10^{83}:\\ \;\;\;\;x - \frac{\left(x - y\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(\left(x - y\right) \cdot \frac{\sqrt[3]{z}}{t}\right) \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

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