Average Error: 6.7 → 1.9
Time: 15.3s
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(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right) + x\\ \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(\frac{z \cdot y}{t} - \frac{x \cdot z}{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 r20710165 = x;
        double r20710166 = y;
        double r20710167 = r20710166 - r20710165;
        double r20710168 = z;
        double r20710169 = r20710167 * r20710168;
        double r20710170 = t;
        double r20710171 = r20710169 / r20710170;
        double r20710172 = r20710165 + r20710171;
        return r20710172;
}

double f(double x, double y, double z, double t) {
        double r20710173 = t;
        double r20710174 = -7160.27886158334;
        bool r20710175 = r20710173 <= r20710174;
        double r20710176 = x;
        double r20710177 = z;
        double r20710178 = y;
        double r20710179 = r20710178 - r20710176;
        double r20710180 = r20710179 / r20710173;
        double r20710181 = r20710177 * r20710180;
        double r20710182 = r20710176 + r20710181;
        double r20710183 = -5.485219336659275e-236;
        bool r20710184 = r20710173 <= r20710183;
        double r20710185 = r20710177 * r20710178;
        double r20710186 = r20710185 / r20710173;
        double r20710187 = r20710176 * r20710177;
        double r20710188 = r20710187 / r20710173;
        double r20710189 = r20710186 - r20710188;
        double r20710190 = r20710189 + r20710176;
        double r20710191 = r20710173 / r20710177;
        double r20710192 = r20710179 / r20710191;
        double r20710193 = r20710176 + r20710192;
        double r20710194 = r20710184 ? r20710190 : r20710193;
        double r20710195 = r20710175 ? r20710182 : r20710194;
        return r20710195;
}

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. Using strategy rm
    3. Applied associate-/l*1.9

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Taylor expanded around 0 1.5

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

    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(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right) + x\\ \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)))