Average Error: 2.4 → 2.3
Time: 8.7s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.302861465504407628771627517380675007177 \cdot 10^{-237} \lor \neg \left(y \le 3.485502824880024639059921425925696558981 \cdot 10^{-153}\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 -4.302861465504407628771627517380675007177 \cdot 10^{-237} \lor \neg \left(y \le 3.485502824880024639059921425925696558981 \cdot 10^{-153}\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 r403616 = x;
        double r403617 = y;
        double r403618 = r403616 - r403617;
        double r403619 = z;
        double r403620 = r403619 - r403617;
        double r403621 = r403618 / r403620;
        double r403622 = t;
        double r403623 = r403621 * r403622;
        return r403623;
}

double f(double x, double y, double z, double t) {
        double r403624 = y;
        double r403625 = -4.3028614655044076e-237;
        bool r403626 = r403624 <= r403625;
        double r403627 = 3.4855028248800246e-153;
        bool r403628 = r403624 <= r403627;
        double r403629 = !r403628;
        bool r403630 = r403626 || r403629;
        double r403631 = x;
        double r403632 = z;
        double r403633 = r403632 - r403624;
        double r403634 = r403631 / r403633;
        double r403635 = r403624 / r403633;
        double r403636 = r403634 - r403635;
        double r403637 = t;
        double r403638 = r403636 * r403637;
        double r403639 = r403631 - r403624;
        double r403640 = r403637 / r403633;
        double r403641 = r403639 * r403640;
        double r403642 = r403630 ? r403638 : r403641;
        return r403642;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -4.3028614655044076e-237 or 3.4855028248800246e-153 < y

    1. Initial program 1.4

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

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

    if -4.3028614655044076e-237 < y < 3.4855028248800246e-153

    1. Initial program 7.2

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

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

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

      \[\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 -4.302861465504407628771627517380675007177 \cdot 10^{-237} \lor \neg \left(y \le 3.485502824880024639059921425925696558981 \cdot 10^{-153}\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 2019353 +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))