Average Error: 6.7 → 1.9
Time: 15.5s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -7160.278861583339676144532859325408935547:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;t \le -5.485219336659275411636551846957666382716 \cdot 10^{-236}:\\ \;\;\;\;\left(x + \frac{z \cdot y}{t}\right) - \frac{x \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;t \le -7160.278861583339676144532859325408935547:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r26212223 = x;
        double r26212224 = y;
        double r26212225 = r26212224 - r26212223;
        double r26212226 = z;
        double r26212227 = r26212225 * r26212226;
        double r26212228 = t;
        double r26212229 = r26212227 / r26212228;
        double r26212230 = r26212223 + r26212229;
        return r26212230;
}

double f(double x, double y, double z, double t) {
        double r26212231 = t;
        double r26212232 = -7160.27886158334;
        bool r26212233 = r26212231 <= r26212232;
        double r26212234 = x;
        double r26212235 = z;
        double r26212236 = y;
        double r26212237 = r26212236 - r26212234;
        double r26212238 = r26212237 / r26212231;
        double r26212239 = r26212235 * r26212238;
        double r26212240 = r26212234 + r26212239;
        double r26212241 = -5.485219336659275e-236;
        bool r26212242 = r26212231 <= r26212241;
        double r26212243 = r26212235 * r26212236;
        double r26212244 = r26212243 / r26212231;
        double r26212245 = r26212234 + r26212244;
        double r26212246 = r26212234 * r26212235;
        double r26212247 = r26212246 / r26212231;
        double r26212248 = r26212245 - r26212247;
        double r26212249 = r26212231 / r26212235;
        double r26212250 = r26212237 / r26212249;
        double r26212251 = r26212234 + r26212250;
        double r26212252 = r26212242 ? r26212248 : r26212251;
        double r26212253 = r26212233 ? r26212240 : r26212252;
        return r26212253;
}

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.7
Target2.1
Herbie1.9
\[\begin{array}{l} \mathbf{if}\;x \lt -9.025511195533004570453352523209034680317 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.275032163700714748507147332551979944314 \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 3 regimes
  2. if t < -7160.27886158334

    1. Initial program 9.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 associate-/r/1.2

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

    if -7160.27886158334 < t < -5.485219336659275e-236

    1. Initial program 1.5

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

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

    if -5.485219336659275e-236 < t

    1. Initial program 6.7

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.9

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

Reproduce

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

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