Average Error: 2.5 → 2.4
Time: 16.4s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.576071319792023313107117462362743129483 \cdot 10^{-193} \lor \neg \left(y \le 2.769657224942360588254267381101232254796 \cdot 10^{-67}\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 -1.576071319792023313107117462362743129483 \cdot 10^{-193} \lor \neg \left(y \le 2.769657224942360588254267381101232254796 \cdot 10^{-67}\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 r348991 = x;
        double r348992 = y;
        double r348993 = r348991 - r348992;
        double r348994 = z;
        double r348995 = r348994 - r348992;
        double r348996 = r348993 / r348995;
        double r348997 = t;
        double r348998 = r348996 * r348997;
        return r348998;
}

double f(double x, double y, double z, double t) {
        double r348999 = y;
        double r349000 = -1.5760713197920233e-193;
        bool r349001 = r348999 <= r349000;
        double r349002 = 2.7696572249423606e-67;
        bool r349003 = r348999 <= r349002;
        double r349004 = !r349003;
        bool r349005 = r349001 || r349004;
        double r349006 = x;
        double r349007 = z;
        double r349008 = r349007 - r348999;
        double r349009 = r349006 / r349008;
        double r349010 = r348999 / r349008;
        double r349011 = r349009 - r349010;
        double r349012 = t;
        double r349013 = r349011 * r349012;
        double r349014 = r349006 - r348999;
        double r349015 = r349012 / r349008;
        double r349016 = r349014 * r349015;
        double r349017 = r349005 ? r349013 : r349016;
        return r349017;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -1.5760713197920233e-193 or 2.7696572249423606e-67 < y

    1. Initial program 1.0

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

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

    if -1.5760713197920233e-193 < y < 2.7696572249423606e-67

    1. Initial program 6.5

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.576071319792023313107117462362743129483 \cdot 10^{-193} \lor \neg \left(y \le 2.769657224942360588254267381101232254796 \cdot 10^{-67}\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 2019212 +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))