Average Error: 2.3 → 0.8
Time: 12.7s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -2.892583399114032623846849144062531563223 \cdot 10^{-313}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \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 = -\infty:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\

\mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -2.892583399114032623846849144062531563223 \cdot 10^{-313}:\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

\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 r17717930 = x;
        double r17717931 = y;
        double r17717932 = r17717930 - r17717931;
        double r17717933 = z;
        double r17717934 = r17717933 - r17717931;
        double r17717935 = r17717932 / r17717934;
        double r17717936 = t;
        double r17717937 = r17717935 * r17717936;
        return r17717937;
}

double f(double x, double y, double z, double t) {
        double r17717938 = x;
        double r17717939 = y;
        double r17717940 = r17717938 - r17717939;
        double r17717941 = z;
        double r17717942 = r17717941 - r17717939;
        double r17717943 = r17717940 / r17717942;
        double r17717944 = t;
        double r17717945 = r17717943 * r17717944;
        double r17717946 = -inf.0;
        bool r17717947 = r17717945 <= r17717946;
        double r17717948 = r17717944 / r17717942;
        double r17717949 = r17717940 * r17717948;
        double r17717950 = -2.892583399114e-313;
        bool r17717951 = r17717945 <= r17717950;
        double r17717952 = 0.0;
        bool r17717953 = r17717945 <= r17717952;
        double r17717954 = r17717944 * r17717940;
        double r17717955 = r17717954 / r17717942;
        double r17717956 = r17717953 ? r17717955 : r17717945;
        double r17717957 = r17717951 ? r17717945 : r17717956;
        double r17717958 = r17717947 ? r17717949 : r17717957;
        return r17717958;
}

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
Herbie0.8
\[\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 div-inv64.0

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

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

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

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

    1. Initial program 0.9

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

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

    1. Initial program 8.7

      \[\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 3 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -2.892583399114032623846849144062531563223 \cdot 10^{-313}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \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 2019179 +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))