Average Error: 2.4 → 2.3
Time: 6.2s
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 r472419 = x;
        double r472420 = y;
        double r472421 = r472419 - r472420;
        double r472422 = z;
        double r472423 = r472422 - r472420;
        double r472424 = r472421 / r472423;
        double r472425 = t;
        double r472426 = r472424 * r472425;
        return r472426;
}

double f(double x, double y, double z, double t) {
        double r472427 = y;
        double r472428 = -4.3028614655044076e-237;
        bool r472429 = r472427 <= r472428;
        double r472430 = 3.4855028248800246e-153;
        bool r472431 = r472427 <= r472430;
        double r472432 = !r472431;
        bool r472433 = r472429 || r472432;
        double r472434 = x;
        double r472435 = z;
        double r472436 = r472435 - r472427;
        double r472437 = r472434 / r472436;
        double r472438 = r472427 / r472436;
        double r472439 = r472437 - r472438;
        double r472440 = t;
        double r472441 = r472439 * r472440;
        double r472442 = r472434 - r472427;
        double r472443 = r472440 / r472436;
        double r472444 = r472442 * r472443;
        double r472445 = r472433 ? r472441 : r472444;
        return r472445;
}

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