Average Error: 2.4 → 1.1
Time: 37.6s
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.740870153098579634621838436917660416566 \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.740870153098579634621838436917660416566 \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 r20305184 = x;
        double r20305185 = y;
        double r20305186 = r20305184 - r20305185;
        double r20305187 = z;
        double r20305188 = r20305187 - r20305185;
        double r20305189 = r20305186 / r20305188;
        double r20305190 = t;
        double r20305191 = r20305189 * r20305190;
        return r20305191;
}

double f(double x, double y, double z, double t) {
        double r20305192 = x;
        double r20305193 = y;
        double r20305194 = r20305192 - r20305193;
        double r20305195 = z;
        double r20305196 = r20305195 - r20305193;
        double r20305197 = r20305194 / r20305196;
        double r20305198 = t;
        double r20305199 = r20305197 * r20305198;
        double r20305200 = -inf.0;
        bool r20305201 = r20305199 <= r20305200;
        double r20305202 = 1.0;
        double r20305203 = r20305202 / r20305196;
        double r20305204 = r20305198 * r20305194;
        double r20305205 = r20305203 * r20305204;
        double r20305206 = -2.7408701530985796e-304;
        bool r20305207 = r20305199 <= r20305206;
        double r20305208 = 0.0;
        bool r20305209 = r20305199 <= r20305208;
        double r20305210 = r20305198 / r20305196;
        double r20305211 = r20305194 * r20305210;
        double r20305212 = r20305209 ? r20305211 : r20305199;
        double r20305213 = r20305207 ? r20305199 : r20305212;
        double r20305214 = r20305201 ? r20305205 : r20305213;
        return r20305214;
}

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.4
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 64.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied div-inv64.0

      \[\leadsto \frac{1}{\color{blue}{\left(z - y\right) \cdot \frac{1}{x - y}}} \cdot t\]
    6. Applied *-un-lft-identity64.0

      \[\leadsto \frac{\color{blue}{1 \cdot 1}}{\left(z - y\right) \cdot \frac{1}{x - y}} \cdot t\]
    7. Applied times-frac64.0

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

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

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

    if -inf.0 < (* (/ (- x y) (- z y)) t) < -2.7408701530985796e-304 or 0.0 < (* (/ (- x y) (- z y)) t)

    1. Initial program 1.1

      \[\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.740870153098579634621838436917660416566 \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))