Average Error: 6.5 → 1.6
Time: 3.6s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.3470219673435147 \cdot 10^{-109} \lor \neg \left(t \le 7.16783763326229843 \cdot 10^{-96}\right):\\ \;\;\;\;{\left(x + \frac{y - x}{\frac{t}{z}}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;t \le -9.3470219673435147 \cdot 10^{-109} \lor \neg \left(t \le 7.16783763326229843 \cdot 10^{-96}\right):\\
\;\;\;\;{\left(x + \frac{y - x}{\frac{t}{z}}\right)}^{1}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r453064 = x;
        double r453065 = y;
        double r453066 = r453065 - r453064;
        double r453067 = z;
        double r453068 = r453066 * r453067;
        double r453069 = t;
        double r453070 = r453068 / r453069;
        double r453071 = r453064 + r453070;
        return r453071;
}

double f(double x, double y, double z, double t) {
        double r453072 = t;
        double r453073 = -9.347021967343515e-109;
        bool r453074 = r453072 <= r453073;
        double r453075 = 7.1678376332622984e-96;
        bool r453076 = r453072 <= r453075;
        double r453077 = !r453076;
        bool r453078 = r453074 || r453077;
        double r453079 = x;
        double r453080 = y;
        double r453081 = r453080 - r453079;
        double r453082 = z;
        double r453083 = r453072 / r453082;
        double r453084 = r453081 / r453083;
        double r453085 = r453079 + r453084;
        double r453086 = 1.0;
        double r453087 = pow(r453085, r453086);
        double r453088 = r453081 * r453082;
        double r453089 = r453088 / r453072;
        double r453090 = r453079 + r453089;
        double r453091 = r453078 ? r453087 : r453090;
        return r453091;
}

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

Original6.5
Target2.0
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;x \lt -9.0255111955330046 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.2750321637007147 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -9.347021967343515e-109 or 7.1678376332622984e-96 < t

    1. Initial program 7.4

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied pow11.2

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

    if -9.347021967343515e-109 < t < 7.1678376332622984e-96

    1. Initial program 3.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9.3470219673435147 \cdot 10^{-109} \lor \neg \left(t \le 7.16783763326229843 \cdot 10^{-96}\right):\\ \;\;\;\;{\left(x + \frac{y - x}{\frac{t}{z}}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020062 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

  (+ x (/ (* (- y x) z) t)))