Average Error: 2.2 → 1.2
Time: 47.7s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -1.3538191510586175 \cdot 10^{-253}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{elif}\;\frac{x - y}{z - y} \le 7.5690856942879 \cdot 10^{-321}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \le -1.3538191510586175 \cdot 10^{-253}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\

\mathbf{elif}\;\frac{x - y}{z - y} \le 7.5690856942879 \cdot 10^{-321}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r17194492 = x;
        double r17194493 = y;
        double r17194494 = r17194492 - r17194493;
        double r17194495 = z;
        double r17194496 = r17194495 - r17194493;
        double r17194497 = r17194494 / r17194496;
        double r17194498 = t;
        double r17194499 = r17194497 * r17194498;
        return r17194499;
}

double f(double x, double y, double z, double t) {
        double r17194500 = x;
        double r17194501 = y;
        double r17194502 = r17194500 - r17194501;
        double r17194503 = z;
        double r17194504 = r17194503 - r17194501;
        double r17194505 = r17194502 / r17194504;
        double r17194506 = -1.3538191510586175e-253;
        bool r17194507 = r17194505 <= r17194506;
        double r17194508 = t;
        double r17194509 = r17194504 / r17194502;
        double r17194510 = r17194508 / r17194509;
        double r17194511 = 7.5690856942879e-321;
        bool r17194512 = r17194505 <= r17194511;
        double r17194513 = r17194502 * r17194508;
        double r17194514 = r17194513 / r17194504;
        double r17194515 = r17194512 ? r17194514 : r17194510;
        double r17194516 = r17194507 ? r17194510 : r17194515;
        return r17194516;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (- x y) (- z y)) < -1.3538191510586175e-253 or 7.5690856942879e-321 < (/ (- x y) (- z y))

    1. Initial program 1.3

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied associate-*l/1.2

      \[\leadsto \color{blue}{\frac{1 \cdot t}{\frac{z - y}{x - y}}}\]
    6. Simplified1.2

      \[\leadsto \frac{\color{blue}{t}}{\frac{z - y}{x - y}}\]

    if -1.3538191510586175e-253 < (/ (- x y) (- z y)) < 7.5690856942879e-321

    1. Initial program 18.9

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied associate-*l/0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -1.3538191510586175 \cdot 10^{-253}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{elif}\;\frac{x - y}{z - y} \le 7.5690856942879 \cdot 10^{-321}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \end{array}\]

Reproduce

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