Average Error: 2.4 → 2.3
Time: 6.4s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.302861465504407628771627517380675007177 \cdot 10^{-237} \lor \neg \left(y \le 3.485502824880024639059921425925696558981 \cdot 10^{-153}\right):\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -4.302861465504407628771627517380675007177 \cdot 10^{-237} \lor \neg \left(y \le 3.485502824880024639059921425925696558981 \cdot 10^{-153}\right):\\
\;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r516629 = x;
        double r516630 = y;
        double r516631 = r516629 - r516630;
        double r516632 = z;
        double r516633 = r516632 - r516630;
        double r516634 = r516631 / r516633;
        double r516635 = t;
        double r516636 = r516634 * r516635;
        return r516636;
}

double f(double x, double y, double z, double t) {
        double r516637 = y;
        double r516638 = -4.3028614655044076e-237;
        bool r516639 = r516637 <= r516638;
        double r516640 = 3.4855028248800246e-153;
        bool r516641 = r516637 <= r516640;
        double r516642 = !r516641;
        bool r516643 = r516639 || r516642;
        double r516644 = x;
        double r516645 = z;
        double r516646 = r516645 - r516637;
        double r516647 = r516644 / r516646;
        double r516648 = r516637 / r516646;
        double r516649 = r516647 - r516648;
        double r516650 = t;
        double r516651 = r516649 * r516650;
        double r516652 = r516644 - r516637;
        double r516653 = r516650 / r516646;
        double r516654 = r516652 * r516653;
        double r516655 = r516643 ? r516651 : r516654;
        return r516655;
}

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

Original2.4
Target2.5
Herbie2.3
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.3028614655044076e-237 or 3.4855028248800246e-153 < y

    1. Initial program 1.4

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-sub1.4

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

    if -4.3028614655044076e-237 < y < 3.4855028248800246e-153

    1. Initial program 7.2

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-inv7.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.302861465504407628771627517380675007177 \cdot 10^{-237} \lor \neg \left(y \le 3.485502824880024639059921425925696558981 \cdot 10^{-153}\right):\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019353 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (/ t (/ (- z y) (- x y)))

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