Average Error: 2.1 → 2.3
Time: 14.3s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.015019325632516171025803372085454949037 \cdot 10^{-235} \lor \neg \left(y \le 5.462124745748530437567551822935668868763 \cdot 10^{-119}\right):\\ \;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -1.015019325632516171025803372085454949037 \cdot 10^{-235} \lor \neg \left(y \le 5.462124745748530437567551822935668868763 \cdot 10^{-119}\right):\\
\;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r460003 = x;
        double r460004 = y;
        double r460005 = r460003 - r460004;
        double r460006 = z;
        double r460007 = r460006 - r460004;
        double r460008 = r460005 / r460007;
        double r460009 = t;
        double r460010 = r460008 * r460009;
        return r460010;
}

double f(double x, double y, double z, double t) {
        double r460011 = y;
        double r460012 = -1.0150193256325162e-235;
        bool r460013 = r460011 <= r460012;
        double r460014 = 5.46212474574853e-119;
        bool r460015 = r460011 <= r460014;
        double r460016 = !r460015;
        bool r460017 = r460013 || r460016;
        double r460018 = x;
        double r460019 = r460018 - r460011;
        double r460020 = 1.0;
        double r460021 = z;
        double r460022 = r460021 - r460011;
        double r460023 = r460020 / r460022;
        double r460024 = r460019 * r460023;
        double r460025 = t;
        double r460026 = r460024 * r460025;
        double r460027 = r460019 * r460025;
        double r460028 = r460027 / r460022;
        double r460029 = r460017 ? r460026 : r460028;
        return r460029;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -1.0150193256325162e-235 or 5.46212474574853e-119 < y

    1. Initial program 1.2

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

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

    if -1.0150193256325162e-235 < y < 5.46212474574853e-119

    1. Initial program 5.8

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

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

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

      \[\leadsto \left(x - y\right) \cdot \color{blue}{\frac{t}{z - y}}\]
    6. Using strategy rm
    7. Applied pow15.5

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

      \[\leadsto \color{blue}{{\left(x - y\right)}^{1}} \cdot {\left(\frac{t}{z - y}\right)}^{1}\]
    9. Applied pow-prod-down5.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.015019325632516171025803372085454949037 \cdot 10^{-235} \lor \neg \left(y \le 5.462124745748530437567551822935668868763 \cdot 10^{-119}\right):\\ \;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"

  :herbie-target
  (/ t (/ (- z y) (- x y)))

  (* (/ (- x y) (- z y)) t))