Average Error: 2.3 → 1.1
Time: 18.0s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\ \;\;\;\;\frac{1}{z - y} \cdot \left(t \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -2.7408701530985796 \cdot 10^{-304}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le 0.0:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\
\;\;\;\;\frac{1}{z - y} \cdot \left(t \cdot \left(x - y\right)\right)\\

\mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -2.7408701530985796 \cdot 10^{-304}:\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

\end{array}
double f(double x, double y, double z, double t) {
        double r24174501 = x;
        double r24174502 = y;
        double r24174503 = r24174501 - r24174502;
        double r24174504 = z;
        double r24174505 = r24174504 - r24174502;
        double r24174506 = r24174503 / r24174505;
        double r24174507 = t;
        double r24174508 = r24174506 * r24174507;
        return r24174508;
}

double f(double x, double y, double z, double t) {
        double r24174509 = x;
        double r24174510 = y;
        double r24174511 = r24174509 - r24174510;
        double r24174512 = z;
        double r24174513 = r24174512 - r24174510;
        double r24174514 = r24174511 / r24174513;
        double r24174515 = t;
        double r24174516 = r24174514 * r24174515;
        double r24174517 = -inf.0;
        bool r24174518 = r24174516 <= r24174517;
        double r24174519 = 1.0;
        double r24174520 = r24174519 / r24174513;
        double r24174521 = r24174515 * r24174511;
        double r24174522 = r24174520 * r24174521;
        double r24174523 = -2.7408701530985796e-304;
        bool r24174524 = r24174516 <= r24174523;
        double r24174525 = 0.0;
        bool r24174526 = r24174516 <= r24174525;
        double r24174527 = r24174515 / r24174513;
        double r24174528 = r24174511 * r24174527;
        double r24174529 = r24174526 ? r24174528 : r24174516;
        double r24174530 = r24174524 ? r24174516 : r24174529;
        double r24174531 = r24174518 ? r24174522 : r24174530;
        return r24174531;
}

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

Derivation

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

    1. Initial program 60.0

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

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

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

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

      \[\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)) t) < -2.7408701530985796e-304 or 0.0 < (* (/ (- x y) (- z y)) t)

    1. Initial program 1.0

      \[\frac{x - y}{z - y} \cdot t\]

    if -2.7408701530985796e-304 < (* (/ (- x y) (- z y)) t) < 0.0

    1. Initial program 8.1

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

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

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

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

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

Reproduce

herbie shell --seed 2019168 +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))