Average Error: 2.5 → 1.7
Time: 2.7s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t \le -1.88173533385725781 \cdot 10^{-15}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -0.0:\\ \;\;\;\;\frac{t \cdot \left(x - y\right)}{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 \le -1.88173533385725781 \cdot 10^{-15}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r400045 = x;
        double r400046 = y;
        double r400047 = r400045 - r400046;
        double r400048 = z;
        double r400049 = r400048 - r400046;
        double r400050 = r400047 / r400049;
        double r400051 = t;
        double r400052 = r400050 * r400051;
        return r400052;
}

double f(double x, double y, double z, double t) {
        double r400053 = x;
        double r400054 = y;
        double r400055 = r400053 - r400054;
        double r400056 = z;
        double r400057 = r400056 - r400054;
        double r400058 = r400055 / r400057;
        double r400059 = t;
        double r400060 = r400058 * r400059;
        double r400061 = -1.881735333857258e-15;
        bool r400062 = r400060 <= r400061;
        double r400063 = r400059 / r400057;
        double r400064 = r400055 * r400063;
        double r400065 = -0.0;
        bool r400066 = r400060 <= r400065;
        double r400067 = r400059 * r400055;
        double r400068 = r400067 / r400057;
        double r400069 = r400066 ? r400068 : r400060;
        double r400070 = r400062 ? r400064 : r400069;
        return r400070;
}

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

Derivation

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

    1. Initial program 2.6

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

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

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

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

    if -1.881735333857258e-15 < (* (/ (- x y) (- z y)) t) < -0.0

    1. Initial program 3.8

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

      \[\leadsto \color{blue}{\left(\left(x - y\right) \cdot \frac{1}{z - y}\right)} \cdot t\]
    4. Using strategy rm
    5. Applied un-div-inv3.8

      \[\leadsto \color{blue}{\frac{x - y}{z - y}} \cdot t\]
    6. Applied associate-*l/1.6

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

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

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

    1. Initial program 1.4

      \[\frac{x - y}{z - y} \cdot t\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.7

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

Reproduce

herbie shell --seed 2020039 +o rules:numerics
(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))