Average Error: 2.5 → 1.7
Time: 2.6s
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{\left(x - y\right) \cdot 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 \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{\left(x - y\right) \cdot 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 r442051 = x;
        double r442052 = y;
        double r442053 = r442051 - r442052;
        double r442054 = z;
        double r442055 = r442054 - r442052;
        double r442056 = r442053 / r442055;
        double r442057 = t;
        double r442058 = r442056 * r442057;
        return r442058;
}

double f(double x, double y, double z, double t) {
        double r442059 = x;
        double r442060 = y;
        double r442061 = r442059 - r442060;
        double r442062 = z;
        double r442063 = r442062 - r442060;
        double r442064 = r442061 / r442063;
        double r442065 = t;
        double r442066 = r442064 * r442065;
        double r442067 = -1.881735333857258e-15;
        bool r442068 = r442066 <= r442067;
        double r442069 = r442065 / r442063;
        double r442070 = r442061 * r442069;
        double r442071 = -0.0;
        bool r442072 = r442066 <= r442071;
        double r442073 = r442061 * r442065;
        double r442074 = r442073 / r442063;
        double r442075 = r442072 ? r442074 : r442066;
        double r442076 = r442068 ? r442070 : r442075;
        return r442076;
}

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 associate-*l/1.6

      \[\leadsto \color{blue}{\frac{\left(x - y\right) \cdot t}{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{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \end{array}\]

Reproduce

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