Average Error: 6.2 → 1.0
Time: 13.2s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty:\\ \;\;\;\;\frac{z}{\frac{t}{y - x}} + x\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \le 4.21688783645265377 \cdot 10^{-84}:\\ \;\;\;\;x + \frac{\left(y - x\right) \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}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty:\\
\;\;\;\;\frac{z}{\frac{t}{y - x}} + x\\

\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \le 4.21688783645265377 \cdot 10^{-84}:\\
\;\;\;\;x + \frac{\left(y - x\right) \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 r501811 = x;
        double r501812 = y;
        double r501813 = r501812 - r501811;
        double r501814 = z;
        double r501815 = r501813 * r501814;
        double r501816 = t;
        double r501817 = r501815 / r501816;
        double r501818 = r501811 + r501817;
        return r501818;
}

double f(double x, double y, double z, double t) {
        double r501819 = x;
        double r501820 = y;
        double r501821 = r501820 - r501819;
        double r501822 = z;
        double r501823 = r501821 * r501822;
        double r501824 = t;
        double r501825 = r501823 / r501824;
        double r501826 = r501819 + r501825;
        double r501827 = -inf.0;
        bool r501828 = r501826 <= r501827;
        double r501829 = r501824 / r501821;
        double r501830 = r501822 / r501829;
        double r501831 = r501830 + r501819;
        double r501832 = 4.216887836452654e-84;
        bool r501833 = r501826 <= r501832;
        double r501834 = r501824 / r501822;
        double r501835 = r501821 / r501834;
        double r501836 = r501819 + r501835;
        double r501837 = r501833 ? r501826 : r501836;
        double r501838 = r501828 ? r501831 : r501837;
        return r501838;
}

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.2
Target2.0
Herbie1.0
\[\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 3 regimes
  2. if (+ x (/ (* (- y x) z) t)) < -inf.0

    1. Initial program 64.0

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

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

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

      \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z}{t}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity0.2

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

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

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

    if -inf.0 < (+ x (/ (* (- y x) z) t)) < 4.216887836452654e-84

    1. Initial program 0.7

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

    if 4.216887836452654e-84 < (+ x (/ (* (- y x) z) t))

    1. Initial program 7.3

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

      \[\leadsto x + \color{blue}{1 \cdot \frac{\left(y - x\right) \cdot z}{t}}\]
    4. Applied *-un-lft-identity7.3

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{\left(y - x\right) \cdot z}{t}\]
    5. Applied distribute-lft-out7.3

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

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

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

Reproduce

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