Average Error: 1.9 → 1.7
Time: 13.3s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.4756492378360466 \cdot 10^{-79} \lor \neg \left(x \le 2.8926516929355669 \cdot 10^{-174}\right):\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{y - x}{\frac{\sqrt[3]{t}}{z}}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x \le -2.4756492378360466 \cdot 10^{-79} \lor \neg \left(x \le 2.8926516929355669 \cdot 10^{-174}\right):\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{y - x}{\frac{\sqrt[3]{t}}{z}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r659049 = x;
        double r659050 = y;
        double r659051 = r659050 - r659049;
        double r659052 = z;
        double r659053 = t;
        double r659054 = r659052 / r659053;
        double r659055 = r659051 * r659054;
        double r659056 = r659049 + r659055;
        return r659056;
}

double f(double x, double y, double z, double t) {
        double r659057 = x;
        double r659058 = -2.4756492378360466e-79;
        bool r659059 = r659057 <= r659058;
        double r659060 = 2.892651692935567e-174;
        bool r659061 = r659057 <= r659060;
        double r659062 = !r659061;
        bool r659063 = r659059 || r659062;
        double r659064 = y;
        double r659065 = r659064 - r659057;
        double r659066 = t;
        double r659067 = z;
        double r659068 = r659066 / r659067;
        double r659069 = r659065 / r659068;
        double r659070 = r659057 + r659069;
        double r659071 = 1.0;
        double r659072 = cbrt(r659066);
        double r659073 = r659072 * r659072;
        double r659074 = r659071 / r659073;
        double r659075 = r659072 / r659067;
        double r659076 = r659065 / r659075;
        double r659077 = r659074 * r659076;
        double r659078 = r659057 + r659077;
        double r659079 = r659063 ? r659070 : r659078;
        return r659079;
}

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

Original1.9
Target1.9
Herbie1.7
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.887:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} \lt -0.0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -2.4756492378360466e-79 or 2.892651692935567e-174 < x

    1. Initial program 0.7

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Using strategy rm
    3. Applied associate-*r/6.9

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

      \[\leadsto x + \color{blue}{1 \cdot \frac{\left(y - x\right) \cdot z}{t}}\]
    6. Applied *-un-lft-identity6.9

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{\left(y - x\right) \cdot z}{t}\]
    7. Applied distribute-lft-out6.9

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

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

    if -2.4756492378360466e-79 < x < 2.892651692935567e-174

    1. Initial program 4.6

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Using strategy rm
    3. Applied associate-*r/4.6

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

      \[\leadsto x + \color{blue}{1 \cdot \frac{\left(y - x\right) \cdot z}{t}}\]
    6. Applied *-un-lft-identity4.6

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{\left(y - x\right) \cdot z}{t}\]
    7. Applied distribute-lft-out4.6

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

      \[\leadsto 1 \cdot \color{blue}{\left(x + \frac{y - x}{\frac{t}{z}}\right)}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity4.5

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

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

      \[\leadsto 1 \cdot \left(x + \frac{y - x}{\color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1} \cdot \frac{\sqrt[3]{t}}{z}}}\right)\]
    13. Applied *-un-lft-identity5.2

      \[\leadsto 1 \cdot \left(x + \frac{\color{blue}{1 \cdot \left(y - x\right)}}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1} \cdot \frac{\sqrt[3]{t}}{z}}\right)\]
    14. Applied times-frac3.9

      \[\leadsto 1 \cdot \left(x + \color{blue}{\frac{1}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1}} \cdot \frac{y - x}{\frac{\sqrt[3]{t}}{z}}}\right)\]
    15. Simplified3.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.4756492378360466 \cdot 10^{-79} \lor \neg \left(x \le 2.8926516929355669 \cdot 10^{-174}\right):\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{y - x}{\frac{\sqrt[3]{t}}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
  :precision binary64

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.887) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) -0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

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