Average Error: 6.1 → 1.6
Time: 3.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.1952969315108972 \cdot 10^{80} \lor \neg \left(z \le 1.66124754788861929 \cdot 10^{-95}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z \cdot y}{t} + x\right) - \frac{x}{\frac{t}{z}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \le -1.1952969315108972 \cdot 10^{80} \lor \neg \left(z \le 1.66124754788861929 \cdot 10^{-95}\right):\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r493189 = x;
        double r493190 = y;
        double r493191 = r493190 - r493189;
        double r493192 = z;
        double r493193 = r493191 * r493192;
        double r493194 = t;
        double r493195 = r493193 / r493194;
        double r493196 = r493189 + r493195;
        return r493196;
}

double f(double x, double y, double z, double t) {
        double r493197 = z;
        double r493198 = -1.1952969315108972e+80;
        bool r493199 = r493197 <= r493198;
        double r493200 = 1.6612475478886193e-95;
        bool r493201 = r493197 <= r493200;
        double r493202 = !r493201;
        bool r493203 = r493199 || r493202;
        double r493204 = x;
        double r493205 = y;
        double r493206 = r493205 - r493204;
        double r493207 = t;
        double r493208 = r493197 / r493207;
        double r493209 = r493206 * r493208;
        double r493210 = r493204 + r493209;
        double r493211 = r493197 * r493205;
        double r493212 = r493211 / r493207;
        double r493213 = r493212 + r493204;
        double r493214 = r493207 / r493197;
        double r493215 = r493204 / r493214;
        double r493216 = r493213 - r493215;
        double r493217 = r493203 ? r493210 : r493216;
        return r493217;
}

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.1
Target1.8
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 z < -1.1952969315108972e+80 or 1.6612475478886193e-95 < z

    1. Initial program 13.0

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

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

      \[\leadsto x + \color{blue}{\frac{y - x}{1} \cdot \frac{z}{t}}\]
    5. Simplified2.6

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

    if -1.1952969315108972e+80 < z < 1.6612475478886193e-95

    1. Initial program 1.5

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

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

      \[\leadsto x + \color{blue}{\left(\frac{y}{\frac{t}{z}} - \frac{x}{\frac{t}{z}}\right)}\]
    6. Applied associate-+r-1.0

      \[\leadsto \color{blue}{\left(x + \frac{y}{\frac{t}{z}}\right) - \frac{x}{\frac{t}{z}}}\]
    7. Simplified0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.1952969315108972 \cdot 10^{80} \lor \neg \left(z \le 1.66124754788861929 \cdot 10^{-95}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z \cdot y}{t} + x\right) - \frac{x}{\frac{t}{z}}\\ \end{array}\]

Reproduce

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