Average Error: 2.0 → 2.0
Time: 21.0s
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 r25194742 = x;
        double r25194743 = y;
        double r25194744 = r25194743 - r25194742;
        double r25194745 = z;
        double r25194746 = t;
        double r25194747 = r25194745 / r25194746;
        double r25194748 = r25194744 * r25194747;
        double r25194749 = r25194742 + r25194748;
        return r25194749;
}

double f(double x, double y, double z, double t) {
        double r25194750 = x;
        double r25194751 = -1.1468504469644174e-191;
        bool r25194752 = r25194750 <= r25194751;
        double r25194753 = z;
        double r25194754 = t;
        double r25194755 = r25194753 / r25194754;
        double r25194756 = y;
        double r25194757 = r25194756 - r25194750;
        double r25194758 = r25194755 * r25194757;
        double r25194759 = r25194750 + r25194758;
        double r25194760 = 1.4085585403251575e-159;
        bool r25194761 = r25194750 <= r25194760;
        double r25194762 = 1.0;
        double r25194763 = r25194762 / r25194754;
        double r25194764 = r25194762 / r25194756;
        double r25194765 = r25194764 / r25194753;
        double r25194766 = r25194763 / r25194765;
        double r25194767 = r25194753 * r25194750;
        double r25194768 = r25194767 / r25194754;
        double r25194769 = r25194766 - r25194768;
        double r25194770 = r25194750 + r25194769;
        double r25194771 = r25194761 ? r25194770 : r25194759;
        double r25194772 = r25194752 ? r25194759 : r25194771;
        return r25194772;
}

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))))