Average Error: 2.3 → 1.9
Time: 3.7s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t \le -3.65173919326576738 \cdot 10^{-273}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le 5.8569725718410323 \cdot 10^{-10}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \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}\;\frac{x - y}{z - y} \cdot t \le -3.65173919326576738 \cdot 10^{-273}:\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r540052 = x;
        double r540053 = y;
        double r540054 = r540052 - r540053;
        double r540055 = z;
        double r540056 = r540055 - r540053;
        double r540057 = r540054 / r540056;
        double r540058 = t;
        double r540059 = r540057 * r540058;
        return r540059;
}

double f(double x, double y, double z, double t) {
        double r540060 = x;
        double r540061 = y;
        double r540062 = r540060 - r540061;
        double r540063 = z;
        double r540064 = r540063 - r540061;
        double r540065 = r540062 / r540064;
        double r540066 = t;
        double r540067 = r540065 * r540066;
        double r540068 = -3.6517391932657674e-273;
        bool r540069 = r540067 <= r540068;
        double r540070 = 5.856972571841032e-10;
        bool r540071 = r540067 <= r540070;
        double r540072 = r540062 * r540066;
        double r540073 = r540072 / r540064;
        double r540074 = r540066 / r540064;
        double r540075 = r540062 * r540074;
        double r540076 = r540071 ? r540073 : r540075;
        double r540077 = r540069 ? r540067 : r540076;
        return r540077;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (* (/ (- x y) (- z y)) t) < -3.6517391932657674e-273

    1. Initial program 1.5

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

    if -3.6517391932657674e-273 < (* (/ (- x y) (- z y)) t) < 5.856972571841032e-10

    1. Initial program 2.9

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

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

    if 5.856972571841032e-10 < (* (/ (- x y) (- z y)) t)

    1. Initial program 3.1

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

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

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

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

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

Reproduce

herbie shell --seed 2020035 
(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))