Average Error: 2.2 → 1.6
Time: 42.0s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} = -\infty:\\ \;\;\;\;\frac{1}{z - y} \cdot \left(\left(x - y\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} = -\infty:\\
\;\;\;\;\frac{1}{z - y} \cdot \left(\left(x - y\right) \cdot t\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r22771609 = x;
        double r22771610 = y;
        double r22771611 = r22771609 - r22771610;
        double r22771612 = z;
        double r22771613 = r22771612 - r22771610;
        double r22771614 = r22771611 / r22771613;
        double r22771615 = t;
        double r22771616 = r22771614 * r22771615;
        return r22771616;
}

double f(double x, double y, double z, double t) {
        double r22771617 = x;
        double r22771618 = y;
        double r22771619 = r22771617 - r22771618;
        double r22771620 = z;
        double r22771621 = r22771620 - r22771618;
        double r22771622 = r22771619 / r22771621;
        double r22771623 = -inf.0;
        bool r22771624 = r22771622 <= r22771623;
        double r22771625 = 1.0;
        double r22771626 = r22771625 / r22771621;
        double r22771627 = t;
        double r22771628 = r22771619 * r22771627;
        double r22771629 = r22771626 * r22771628;
        double r22771630 = r22771617 / r22771621;
        double r22771631 = r22771618 / r22771621;
        double r22771632 = r22771630 - r22771631;
        double r22771633 = r22771632 * r22771627;
        double r22771634 = r22771624 ? r22771629 : r22771633;
        return r22771634;
}

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.2
Target2.1
Herbie1.6
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (- x y) (- z y)) < -inf.0

    1. Initial program 64.0

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

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

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

      \[\leadsto \left(x - y\right) \cdot \color{blue}{\frac{t}{z - y}}\]
    6. Using strategy rm
    7. Applied div-inv0.3

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

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

    if -inf.0 < (/ (- x y) (- z y))

    1. Initial program 1.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} = -\infty:\\ \;\;\;\;\frac{1}{z - y} \cdot \left(\left(x - y\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"

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

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