Average Error: 1.9 → 1.5
Time: 12.9s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -2.00668391931767575 \cdot 10^{34} \lor \neg \left(t \le 3.16207688033320828 \cdot 10^{29}\right):\\ \;\;\;\;\frac{z}{\frac{t}{y - x}} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;t \le -2.00668391931767575 \cdot 10^{34} \lor \neg \left(t \le 3.16207688033320828 \cdot 10^{29}\right):\\
\;\;\;\;\frac{z}{\frac{t}{y - x}} + x\\

\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r245781 = x;
        double r245782 = y;
        double r245783 = r245782 - r245781;
        double r245784 = z;
        double r245785 = t;
        double r245786 = r245784 / r245785;
        double r245787 = r245783 * r245786;
        double r245788 = r245781 + r245787;
        return r245788;
}

double f(double x, double y, double z, double t) {
        double r245789 = t;
        double r245790 = -2.0066839193176758e+34;
        bool r245791 = r245789 <= r245790;
        double r245792 = 3.1620768803332083e+29;
        bool r245793 = r245789 <= r245792;
        double r245794 = !r245793;
        bool r245795 = r245791 || r245794;
        double r245796 = z;
        double r245797 = y;
        double r245798 = x;
        double r245799 = r245797 - r245798;
        double r245800 = r245789 / r245799;
        double r245801 = r245796 / r245800;
        double r245802 = r245801 + r245798;
        double r245803 = r245799 * r245796;
        double r245804 = r245803 / r245789;
        double r245805 = r245798 + r245804;
        double r245806 = r245795 ? r245802 : r245805;
        return r245806;
}

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
Target2.1
Herbie1.5
\[\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 t < -2.0066839193176758e+34 or 3.1620768803332083e+29 < t

    1. Initial program 1.1

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

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

      \[\leadsto x + \color{blue}{{\left(y - x\right)}^{1}} \cdot {\left(\frac{z}{t}\right)}^{1}\]
    5. Applied pow-prod-down1.1

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

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

    if -2.0066839193176758e+34 < t < 3.1620768803332083e+29

    1. Initial program 3.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.00668391931767575 \cdot 10^{34} \lor \neg \left(t \le 3.16207688033320828 \cdot 10^{29}\right):\\ \;\;\;\;\frac{z}{\frac{t}{y - x}} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]

Reproduce

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