Average Error: 1.8 → 2.2
Time: 19.7s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -20778392.899190597:\\ \;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{elif}\;x \le 4.770204854801331 \cdot 10^{-270}:\\ \;\;\;\;\left(\frac{z}{\frac{t}{y}} - \frac{z \cdot x}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x \le -20778392.899190597:\\
\;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\

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

\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r28661016 = x;
        double r28661017 = y;
        double r28661018 = r28661017 - r28661016;
        double r28661019 = z;
        double r28661020 = t;
        double r28661021 = r28661019 / r28661020;
        double r28661022 = r28661018 * r28661021;
        double r28661023 = r28661016 + r28661022;
        return r28661023;
}

double f(double x, double y, double z, double t) {
        double r28661024 = x;
        double r28661025 = -20778392.899190597;
        bool r28661026 = r28661024 <= r28661025;
        double r28661027 = z;
        double r28661028 = t;
        double r28661029 = r28661027 / r28661028;
        double r28661030 = y;
        double r28661031 = r28661030 - r28661024;
        double r28661032 = r28661029 * r28661031;
        double r28661033 = r28661024 + r28661032;
        double r28661034 = 4.770204854801331e-270;
        bool r28661035 = r28661024 <= r28661034;
        double r28661036 = r28661028 / r28661030;
        double r28661037 = r28661027 / r28661036;
        double r28661038 = r28661027 * r28661024;
        double r28661039 = r28661038 / r28661028;
        double r28661040 = r28661037 - r28661039;
        double r28661041 = r28661040 + r28661024;
        double r28661042 = r28661028 / r28661027;
        double r28661043 = r28661031 / r28661042;
        double r28661044 = r28661024 + r28661043;
        double r28661045 = r28661035 ? r28661041 : r28661044;
        double r28661046 = r28661026 ? r28661033 : r28661045;
        return r28661046;
}

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.8
Target2.0
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.8867:\\ \;\;\;\;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 3 regimes
  2. if x < -20778392.899190597

    1. Initial program 0.1

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

    if -20778392.899190597 < x < 4.770204854801331e-270

    1. Initial program 3.1

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

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

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

    if 4.770204854801331e-270 < x

    1. Initial program 1.7

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

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

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

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

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

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

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

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

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

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

Reproduce

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