Average Error: 2.2 → 2.2
Time: 8.8s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -6.523938592531431327362225760875114999913 \cdot 10^{-162} \lor \neg \left(t \le 6.34702047355559309045456629371189110415 \cdot 10^{-18}\right):\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \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}\;t \le -6.523938592531431327362225760875114999913 \cdot 10^{-162} \lor \neg \left(t \le 6.34702047355559309045456629371189110415 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r559508 = x;
        double r559509 = y;
        double r559510 = r559508 - r559509;
        double r559511 = z;
        double r559512 = r559511 - r559509;
        double r559513 = r559510 / r559512;
        double r559514 = t;
        double r559515 = r559513 * r559514;
        return r559515;
}

double f(double x, double y, double z, double t) {
        double r559516 = t;
        double r559517 = -6.523938592531431e-162;
        bool r559518 = r559516 <= r559517;
        double r559519 = 6.347020473555593e-18;
        bool r559520 = r559516 <= r559519;
        double r559521 = !r559520;
        bool r559522 = r559518 || r559521;
        double r559523 = z;
        double r559524 = y;
        double r559525 = r559523 - r559524;
        double r559526 = x;
        double r559527 = r559526 - r559524;
        double r559528 = r559525 / r559527;
        double r559529 = r559516 / r559528;
        double r559530 = r559527 * r559516;
        double r559531 = r559530 / r559525;
        double r559532 = r559522 ? r559529 : r559531;
        return r559532;
}

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

Derivation

  1. Split input into 2 regimes
  2. if t < -6.523938592531431e-162 or 6.347020473555593e-18 < t

    1. Initial program 2.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied pow12.3

      \[\leadsto \frac{1}{\frac{z - y}{x - y}} \cdot \color{blue}{{t}^{1}}\]
    6. Applied pow12.3

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

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

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

    if -6.523938592531431e-162 < t < 6.347020473555593e-18

    1. Initial program 2.2

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied associate-*l/2.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -6.523938592531431327362225760875114999913 \cdot 10^{-162} \lor \neg \left(t \le 6.34702047355559309045456629371189110415 \cdot 10^{-18}\right):\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019351 +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))