Average Error: 2.4 → 2.3
Time: 8.8s
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 r451649 = x;
        double r451650 = y;
        double r451651 = r451649 - r451650;
        double r451652 = z;
        double r451653 = r451652 - r451650;
        double r451654 = r451651 / r451653;
        double r451655 = t;
        double r451656 = r451654 * r451655;
        return r451656;
}

double f(double x, double y, double z, double t) {
        double r451657 = y;
        double r451658 = -4.3028614655044076e-237;
        bool r451659 = r451657 <= r451658;
        double r451660 = 3.4855028248800246e-153;
        bool r451661 = r451657 <= r451660;
        double r451662 = !r451661;
        bool r451663 = r451659 || r451662;
        double r451664 = x;
        double r451665 = z;
        double r451666 = r451665 - r451657;
        double r451667 = r451664 / r451666;
        double r451668 = r451657 / r451666;
        double r451669 = r451667 - r451668;
        double r451670 = t;
        double r451671 = r451669 * r451670;
        double r451672 = r451664 - r451657;
        double r451673 = r451670 / r451666;
        double r451674 = r451672 * r451673;
        double r451675 = r451663 ? r451671 : r451674;
        return r451675;
}

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))