Average Error: 2.0 → 2.3
Time: 5.8s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.23864684832811672 \cdot 10^{-67} \lor \neg \left(y \le 6.8251508594710119 \cdot 10^{-35}\right):\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \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}\;y \le -2.23864684832811672 \cdot 10^{-67} \lor \neg \left(y \le 6.8251508594710119 \cdot 10^{-35}\right):\\
\;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r549036 = x;
        double r549037 = y;
        double r549038 = r549036 - r549037;
        double r549039 = z;
        double r549040 = r549039 - r549037;
        double r549041 = r549038 / r549040;
        double r549042 = t;
        double r549043 = r549041 * r549042;
        return r549043;
}

double f(double x, double y, double z, double t) {
        double r549044 = y;
        double r549045 = -2.2386468483281167e-67;
        bool r549046 = r549044 <= r549045;
        double r549047 = 6.825150859471012e-35;
        bool r549048 = r549044 <= r549047;
        double r549049 = !r549048;
        bool r549050 = r549046 || r549049;
        double r549051 = x;
        double r549052 = z;
        double r549053 = r549052 - r549044;
        double r549054 = r549051 / r549053;
        double r549055 = r549044 / r549053;
        double r549056 = r549054 - r549055;
        double r549057 = t;
        double r549058 = r549056 * r549057;
        double r549059 = r549051 - r549044;
        double r549060 = r549057 / r549053;
        double r549061 = r549059 * r549060;
        double r549062 = r549050 ? r549058 : r549061;
        return r549062;
}

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.0
Target1.9
Herbie2.3
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -2.2386468483281167e-67 or 6.825150859471012e-35 < y

    1. Initial program 0.2

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

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

    if -2.2386468483281167e-67 < y < 6.825150859471012e-35

    1. Initial program 4.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.23864684832811672 \cdot 10^{-67} \lor \neg \left(y \le 6.8251508594710119 \cdot 10^{-35}\right):\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]

Reproduce

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