Average Error: 2.0 → 2.0
Time: 20.7s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.146850446964417364340873441400790974581 \cdot 10^{-191}:\\ \;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{elif}\;x \le 1.408558540325157523124400703382233120661 \cdot 10^{-159}:\\ \;\;\;\;x + \left(\frac{\frac{1}{t}}{\frac{\frac{1}{y}}{z}} - \frac{z \cdot x}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x \le -1.146850446964417364340873441400790974581 \cdot 10^{-191}:\\
\;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\

\mathbf{elif}\;x \le 1.408558540325157523124400703382233120661 \cdot 10^{-159}:\\
\;\;\;\;x + \left(\frac{\frac{1}{t}}{\frac{\frac{1}{y}}{z}} - \frac{z \cdot x}{t}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r29051749 = x;
        double r29051750 = y;
        double r29051751 = r29051750 - r29051749;
        double r29051752 = z;
        double r29051753 = t;
        double r29051754 = r29051752 / r29051753;
        double r29051755 = r29051751 * r29051754;
        double r29051756 = r29051749 + r29051755;
        return r29051756;
}

double f(double x, double y, double z, double t) {
        double r29051757 = x;
        double r29051758 = -1.1468504469644174e-191;
        bool r29051759 = r29051757 <= r29051758;
        double r29051760 = z;
        double r29051761 = t;
        double r29051762 = r29051760 / r29051761;
        double r29051763 = y;
        double r29051764 = r29051763 - r29051757;
        double r29051765 = r29051762 * r29051764;
        double r29051766 = r29051757 + r29051765;
        double r29051767 = 1.4085585403251575e-159;
        bool r29051768 = r29051757 <= r29051767;
        double r29051769 = 1.0;
        double r29051770 = r29051769 / r29051761;
        double r29051771 = r29051769 / r29051763;
        double r29051772 = r29051771 / r29051760;
        double r29051773 = r29051770 / r29051772;
        double r29051774 = r29051760 * r29051757;
        double r29051775 = r29051774 / r29051761;
        double r29051776 = r29051773 - r29051775;
        double r29051777 = r29051757 + r29051776;
        double r29051778 = r29051768 ? r29051777 : r29051766;
        double r29051779 = r29051759 ? r29051766 : r29051778;
        return r29051779;
}

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

Original2.0
Target2.2
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.88671875:\\ \;\;\;\;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 < -1.1468504469644174e-191 or 1.4085585403251575e-159 < x

    1. Initial program 0.9

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

    if -1.1468504469644174e-191 < x < 1.4085585403251575e-159

    1. Initial program 5.4

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

      \[\leadsto x + \color{blue}{\left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right)}\]
    3. Using strategy rm
    4. Applied associate-/l*5.2

      \[\leadsto x + \left(\color{blue}{\frac{z}{\frac{t}{y}}} - \frac{x \cdot z}{t}\right)\]
    5. Using strategy rm
    6. Applied clear-num5.3

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

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

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

      \[\leadsto x + \left(\frac{1}{\color{blue}{\frac{t}{1} \cdot \frac{\frac{1}{y}}{z}}} - \frac{x \cdot z}{t}\right)\]
    11. Applied associate-/r*5.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.146850446964417364340873441400790974581 \cdot 10^{-191}:\\ \;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{elif}\;x \le 1.408558540325157523124400703382233120661 \cdot 10^{-159}:\\ \;\;\;\;x + \left(\frac{\frac{1}{t}}{\frac{\frac{1}{y}}{z}} - \frac{z \cdot x}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ 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))))