Average Error: 2.0 → 2.5
Time: 4.3s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 2.099420613792782 \cdot 10^{251}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z \cdot \frac{y}{t} - \frac{x \cdot z}{t}\right)\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 2.099420613792782 \cdot 10^{251}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r525917 = x;
        double r525918 = y;
        double r525919 = r525918 - r525917;
        double r525920 = z;
        double r525921 = t;
        double r525922 = r525920 / r525921;
        double r525923 = r525919 * r525922;
        double r525924 = r525917 + r525923;
        return r525924;
}

double f(double x, double y, double z, double t) {
        double r525925 = x;
        double r525926 = y;
        double r525927 = r525926 - r525925;
        double r525928 = z;
        double r525929 = t;
        double r525930 = r525928 / r525929;
        double r525931 = r525927 * r525930;
        double r525932 = r525925 + r525931;
        double r525933 = 2.099420613792782e+251;
        bool r525934 = r525932 <= r525933;
        double r525935 = r525926 / r525929;
        double r525936 = r525928 * r525935;
        double r525937 = r525925 * r525928;
        double r525938 = r525937 / r525929;
        double r525939 = r525936 - r525938;
        double r525940 = r525925 + r525939;
        double r525941 = r525934 ? r525932 : r525940;
        return r525941;
}

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.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 (+ x (* (- y x) (/ z t))) < 2.099420613792782e+251

    1. Initial program 1.3

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

    if 2.099420613792782e+251 < (+ x (* (- y x) (/ z t)))

    1. Initial program 9.4

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

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

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

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \frac{\sqrt[3]{z}}{t}\right)}\]
    6. Applied associate-*r*11.7

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

      \[\leadsto x + \color{blue}{\left(\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(y - x\right)\right)} \cdot \frac{\sqrt[3]{z}}{t}\]
    8. Taylor expanded around 0 13.5

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \le 2.099420613792782 \cdot 10^{251}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z \cdot \frac{y}{t} - \frac{x \cdot z}{t}\right)\\ \end{array}\]

Reproduce

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