Average Error: 2.1 → 2.2
Time: 14.1s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.03768004638703446681329529893279855834 \cdot 10^{-38} \lor \neg \left(y \le 8.760767759743170375553632164025646263167 \cdot 10^{-63}\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.03768004638703446681329529893279855834 \cdot 10^{-38} \lor \neg \left(y \le 8.760767759743170375553632164025646263167 \cdot 10^{-63}\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 r243571 = x;
        double r243572 = y;
        double r243573 = r243571 - r243572;
        double r243574 = z;
        double r243575 = r243574 - r243572;
        double r243576 = r243573 / r243575;
        double r243577 = t;
        double r243578 = r243576 * r243577;
        return r243578;
}

double f(double x, double y, double z, double t) {
        double r243579 = y;
        double r243580 = -4.0376800463870345e-38;
        bool r243581 = r243579 <= r243580;
        double r243582 = 8.76076775974317e-63;
        bool r243583 = r243579 <= r243582;
        double r243584 = !r243583;
        bool r243585 = r243581 || r243584;
        double r243586 = x;
        double r243587 = z;
        double r243588 = r243587 - r243579;
        double r243589 = r243586 / r243588;
        double r243590 = r243579 / r243588;
        double r243591 = r243589 - r243590;
        double r243592 = t;
        double r243593 = r243591 * r243592;
        double r243594 = r243586 - r243579;
        double r243595 = r243592 / r243588;
        double r243596 = r243594 * r243595;
        double r243597 = r243585 ? r243593 : r243596;
        return r243597;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -4.0376800463870345e-38 or 8.76076775974317e-63 < 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 -4.0376800463870345e-38 < y < 8.76076775974317e-63

    1. Initial program 5.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.03768004638703446681329529893279855834 \cdot 10^{-38} \lor \neg \left(y \le 8.760767759743170375553632164025646263167 \cdot 10^{-63}\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 2019322 +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))